I have a protected worksheet and need to have specific cells locked after data is entered. I would also like to keep the filter option working after locking the cell( protect the sheet). I currently have a working code that does what I'm looking for but it covers ALL the unlocked cells on the sheet where data can be entered, I only need to keep the filter option working
Please advise
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect Password:="01234"
For Each cl In Target
If cl.Value <> "" Then
check = MsgBox("Is this entry correct? This cell cannot be changed after entering this value.", vbYesNo, "Cell Lock Notification")
If check = vbYes Then
cl.Locked = True
Else
cl.Value = ""
End If
End If
Next cl
ActiveSheet.Protect Password:="01234"
End Sub
Please advise
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect Password:="01234"
For Each cl In Target
If cl.Value <> "" Then
check = MsgBox("Is this entry correct? This cell cannot be changed after entering this value.", vbYesNo, "Cell Lock Notification")
If check = vbYes Then
cl.Locked = True
Else
cl.Value = ""
End If
End If
Next cl
ActiveSheet.Protect Password:="01234"
End Sub