Ich möchte mehere Bereich im jeweiligen Tabellenblatt vor Veränderung u. löschen schützen,
wenn "kein" Blattschutz aktiv ist.
Bereiche wären : Range("A10:D100", "F4:AJ9")
Wäre gut wenn es im unteren Code miteigebracht werden könnte.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rc As Range
Dim lx As Long
Dim bSet As Boolean
ActiveSheet.Unprotect
If Intersect(Target, Range("F15:AJ18,F22:AJ25,F29:AJ34,F39:AJ56,F61:AJ78,F83:AJ100")) Is _
Nothing Then Exit Sub
For Each rc In Target.Cells
For lx = 5 To 33 Step 4
If rc.Value = Cells(2, lx).Value Then
rc.Interior.ColorIndex = Cells(2, lx).Interior.ColorIndex
rc.Font.ColorIndex = Cells(2, lx).Font.ColorIndex
rc.Font.Bold = Cells(2, lx).Font.Bold = True
rc.Font.Italic = Cells(2, lx).Font.Italic = True
bSet = True
End If
Next lx
If Not (bSet) Then rc.Interior.ColorIndex = xlNone
Next
End Sub
Gruß Matze