Locking cells after choosing a value from drop-down list

jaidubb

Board Regular
Joined
Nov 8, 2011
Messages
55
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?
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top