I've created a test using drop-down list in Excel. I'd like to lock the answer/choice in the cell and prevent it from being changed once the cell id de-selected. I found this VBScript on this site but it doesn't seem to be working.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Select Case Target.Address
Case "$H$7", "$H$12", "$H$17", "$H$22"
ActiveSheet.Unprotect "password"
Target.Locked = True
ActiveSheet.Protect "password"
Case Else:
End Select
End Sub
I've protected the sheet since I don't want any other cells changed. The cells I want to lock are referenced in the Case line. Any ideas?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Select Case Target.Address
Case "$H$7", "$H$12", "$H$17", "$H$22"
ActiveSheet.Unprotect "password"
Target.Locked = True
ActiveSheet.Protect "password"
Case Else:
End Select
End Sub
I've protected the sheet since I don't want any other cells changed. The cells I want to lock are referenced in the Case line. Any ideas?