folegenden Code habe ich in einem Modul stehen.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Unprotect ("123")
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Me.Range("D21:M81")) Is Nothing Then
With Me.Cells(Target.Row, 3)
On Error Resume Next
OldRange.Interior.Color = OldColor
On Error GoTo 0
OldColor = .Interior.Color
.Interior.Color = RGB(0, 255, 0)
End With
Set OldRange = Me.Cells(Target.Row, 3)
Else
OldRange.Interior.Color = OldColor
End If
ActiveSheet.Protect ("123")
End Sub
Der Code funktionert soweit, nur obwohl am Ende des Codes "ActiveSheet.Protect ("123")" steht, wird der Blattschutz nicht aktiv. Hat jemand eine Idee woran das liegt?
Grüße
Thomas