excellingatmyjob
New Member
- Joined
- Aug 19, 2014
- Messages
- 4
Hello,
I have a macro running to hide/unhide certain columns depending on a user's selection in the drop down menu(s). I then unlocked the drop-down menu cells and protected the sheet. When I do so, the following error shows up:
Run-time error '1004":
Unable to set the Hidden property of the Range class
I'm pretty sure this error comes up because the sheet is protected, but how can I make it so the user can select ONLY the drop-down menu cells, yet the macro will still run? Below is my current code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("E29") = "*None" Then
Rows("30:31").EntireRow.Hidden = True
Rows("33").EntireRow.Hidden = False
ElseIf Range("E29") = "Perimeter Handrails Only" Then
Rows("33").EntireRow.Hidden = True
Rows("30:31").EntireRow.Hidden = False
ElseIf Range("E29") = "Flush Platform one Face" Then
Rows("33").EntireRow.Hidden = True
Rows("30:31").EntireRow.Hidden = False
ElseIf Range("E29") = "Offset Platform one Face" Then
Rows("33").EntireRow.Hidden = True
Rows("30:31").EntireRow.Hidden = False
ElseIf Range("E29") = "Other" Then
Rows("33").EntireRow.Hidden = True
Rows("30:31").EntireRow.Hidden = False
End If
End Sub
Any assistance will be greatly appreciated!
Thank you.
I have a macro running to hide/unhide certain columns depending on a user's selection in the drop down menu(s). I then unlocked the drop-down menu cells and protected the sheet. When I do so, the following error shows up:
Run-time error '1004":
Unable to set the Hidden property of the Range class
I'm pretty sure this error comes up because the sheet is protected, but how can I make it so the user can select ONLY the drop-down menu cells, yet the macro will still run? Below is my current code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("E29") = "*None" Then
Rows("30:31").EntireRow.Hidden = True
Rows("33").EntireRow.Hidden = False
ElseIf Range("E29") = "Perimeter Handrails Only" Then
Rows("33").EntireRow.Hidden = True
Rows("30:31").EntireRow.Hidden = False
ElseIf Range("E29") = "Flush Platform one Face" Then
Rows("33").EntireRow.Hidden = True
Rows("30:31").EntireRow.Hidden = False
ElseIf Range("E29") = "Offset Platform one Face" Then
Rows("33").EntireRow.Hidden = True
Rows("30:31").EntireRow.Hidden = False
ElseIf Range("E29") = "Other" Then
Rows("33").EntireRow.Hidden = True
Rows("30:31").EntireRow.Hidden = False
End If
End Sub
Any assistance will be greatly appreciated!
Thank you.