sonofasailor
New Member
- Joined
- Aug 13, 2012
- Messages
- 1
Hello!
I am trying to set and lock the values in two cells when the user selects a particular value from a drop down list in another cell.
Each of the cells have data validation lists as well and they are all different.
Here is what I currently have but it errors on setting the value on H29. The error message i receive is Method 'Value' of object 'Range' failed.
I truly appreciate any help that can be offered!
I am trying to set and lock the values in two cells when the user selects a particular value from a drop down list in another cell.
Each of the cells have data validation lists as well and they are all different.
Here is what I currently have but it errors on setting the value on H29. The error message i receive is Method 'Value' of object 'Range' failed.
I truly appreciate any help that can be offered!
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If [H28] = "-" Then
ActiveSheet.Unprotect
[H29].Value = "N"
[H30].Value = "-"
[H29].Locked = True
[H30].Locked = True
ActiveSheet.Protect
Else
ActiveSheet.Unprotect
[H29].Locked = False
[H30].Locked = False
ActiveSheet.Protect
End If
End Sub