Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 And UCase(Target.Value) = "OK" Then
ActiveSheet.Protect Contents:=False
Cells(Target.Row, 1).Locked = True
Cells(Target.Row, 2).Locked = True
Cells(Target.Row, 3).Locked = True
ActiveSheet.Protect Contents:=True
ElseIf Target.Column = 4 And UCase(Target.Value) <> "OK" Then
ActiveSheet.Protect Contents:=False
Cells(Target.Row, 1).Locked = False
Cells(Target.Row, 2).Locked = False
Cells(Target.Row, 3).Locked = False
ActiveSheet.Protect Contents:=True
End If
End Sub
I have already applied the above macro, which locks the cells A1, B1 and C1 after I enter "OK" in D1, and unlocks the cells A1, B1 and C1 when I remove "OK" from D1.
How can I restrict users, apart from me, from entering data in column D, which is used by me for approving by entering "OK" in it?