ultros1234
New Member
Hi folks --
I need a little help. I'm setting up a spreadsheet that several people will add data to, and I'm trying to set some strict data validation rules. Column H asks, "Is this customer feedback?" possible values yes/no, and Column I asks "Is this a risk issue?" also yes/no.
Columns J-M are feedback related, and I want them to be locked UNLESS column H = "Yes"
Columns N-P are risk related, and I want them to be locked UNLESS column I = "Yes"
I dug up some VBA online that seems like a simple way to solve the problem. Pasted here:
When I use this VBA, then the J3:M3 cells are locked by default. When I change H3 value to "yes," I get the following error: "Run-time error '1004': Unable to set the Locked property of the range class."
Debugging points to this line of the code:
Range("J3:M3").Locked = False
Any ideas?
I need a little help. I'm setting up a spreadsheet that several people will add data to, and I'm trying to set some strict data validation rules. Column H asks, "Is this customer feedback?" possible values yes/no, and Column I asks "Is this a risk issue?" also yes/no.
Columns J-M are feedback related, and I want them to be locked UNLESS column H = "Yes"
Columns N-P are risk related, and I want them to be locked UNLESS column I = "Yes"
I dug up some VBA online that seems like a simple way to solve the problem. Pasted here:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("H3").Value = "Yes" Then
Range("J3:M3").Locked = False
Else
Range("J3:M3").Locked = True
End If
End Sub
When I use this VBA, then the J3:M3 cells are locked by default. When I change H3 value to "yes," I get the following error: "Run-time error '1004': Unable to set the Locked property of the range class."
Debugging points to this line of the code:
Range("J3:M3").Locked = False
Any ideas?
Last edited by a moderator: