Can you please help fix the clear button in SetUp as currently it is throwing an error
Sub Rectangle3_Click()
With Sheets("£SAFE LOG")
.Unprotect Password:="cream"
With .Range("B9:H9, B12:H12, B19:H19, B21:h21, B31:H31")
.ClearContents
.Locked = False
End With
End With
End Sub
The code in the safe log sheet was originally like
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("b9:h9, b12:h12, b19:h19, b21:h21, b31:h31")) Is Nothing Then Exit Sub
ActiveSheet.Unprotect Password:="cream"
Target.Locked = True
ActiveSheet.Protect Password:="cream"
End Sub
but was changed to
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("b9:h9, b12:h12, b19:h19, b21:h21, b31:h31")) Is Nothing Then Exit Sub
If Target.Value = "" Then Exit Sub
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="cream"
Target.Locked = True
ActiveSheet.Protect Password:="cream"
Application.EnableEvents = True
End Sub
This was to prevent the cells from locking when the cell had no input , for example when a user pressed delete the cell would lock even without typing anything. However the change broke the code in the clear button.
Bookmarks