I think it would be easier to accomplish this in a worksheet-change event
like this for example.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 and target.row >= 17 And Target.Value <> "YES" Then ' Check whether the changed cell is in column E and is in row17 or below, and contains something other than "YES"
ActiveSheet.Unprotect
Target.Offset(0, 2).Clear
Target.Offset(0, 2).Locked = True
Target.Offset(0, 2).Value = 0
ActiveSheet.Protect
End If
'EDIT: and maybe this code to unlock the cell?
'If Target.Column = 5 and target.row >=17 And Target.Value = "YES" Then Target.Offset(0, 2).Locked = False
End Sub
Bookmarks