I have already asked a similar question but I am still not getting the results I had hope for. My goal is to have for instance an entire worksheet that is locked so that other users cannot change anything. However, there will be an exception of cells like C6, C12, C18, etc.. In these particular cells there will be a drop down tab where users can select either "red" or "blue". I want those specific cells to be unlocked UNTIL a user selects one of the options and then it has to lock. So basically it will only lock once either red or blue is selected. I have been playing around with it but I can only get it to the point where once any change is made the entire workbook locks, which defeats the purpose. This is what I had written so far which isn't working:
Private Sub Worksheet_Change(ByVal Target As Range) Dim cel As Range
ActiveSheet.Unprotect ' Password:="secret"
For Each cel In Target
If cel.Value = "Red" Or cel.Value = "Blue" Then
cel.Locked = True
Else
cel.Locked = False
End If
Next cel
ActiveSheet.Protect ' Password:= "secret"
End Sub
Private Sub Worksheet_Change(ByVal Target As Range) Dim cel As Range
ActiveSheet.Unprotect ' Password:="secret"
For Each cel In Target
If cel.Value = "Red" Or cel.Value = "Blue" Then
cel.Locked = True
Else
cel.Locked = False
End If
Next cel
ActiveSheet.Protect ' Password:= "secret"
End Sub