AW: Makround Blattschutz
16.10.2018 22:47:56
Christian
Hier der ganze Code eine button sperrt und entsperrt den blattschutz und zwei button für die zellfarbe
AllowFormattingCells:=False hatte ich schon auf true jedoch kam dann ein fehler bei Cells.Interior.ColorIndex = 1
jemand eine idee
danke gruß Christian
Private Sub CommandButton2_Click()
Dim Cells As Range
Dim Bereich As Range
Set Bereich = Worksheets("Daten").Range("F4:H15")
For Each Cells In Bereich
If Cells.Interior.ColorIndex = 1 Then
Cells.Interior.ColorIndex = 2
End If
Next
End Sub
Private Sub CommandButton3_Click()
Dim Cells As Range
Dim Bereich As Range
Set Bereich = Worksheets("Daten").Range("F4:H15")
For Each Cells In Bereich
If Cells.Interior.ColorIndex = 2 Then
Cells.Interior.ColorIndex = 1
End If
Next
End Sub
Private Sub CommandButton1_Click()
If ActiveSheet.ProtectContents = True Then
ActiveSheet.Unprotect
Else
ActiveSheet.Protect Password:="password", DrawingObjects:=True, Contents:=True, Scenarios:=True _
_
, AllowFormattingCells:=False
ActiveSheet.EnableSelection = xlUnlockedCells
End If
End Sub