Before a cell can be locked, you must protect the sheet.
Before protecting the sheet, unlock all the cells you are going to edit.
Try the following code on the events of your sheet. Change in the code "
abc" to the password of your sheet.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Address(0, 0) = "H3" Then
ActiveSheet.Unprotect "abc"
Range("D2").Locked = Target.Value = 1
ActiveSheet.Protect "abc"
End If
End Sub
SHEET EVENT
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.