Hello all, this issue has been stumping me for the longest time and I would greatly appreciate your collective help.
Situation:
I have a worksheet that needs to hide/unhide rows based on a dropdown box (form control). The dropdown box has 3 choices. Depending on the value of the dropdown box, it will hide certain rows. However, the worksheet must be protected because there are formulas within Excel throughout the sheet and as these are being designed for another group, I'd like to have them protected to prevent accidental errors.
Error:
When the sheet is protected and I change the dropdown box (for example from selection 1 to selection 3), I receive a run-time error: 1004. Unable to set the Hidden property of the Range class.
Code:
This is the partial code used. The bolded line is highlighted after clicking on debug.![]()
'Select number of issues Sub DropDown_Number_Issue() Select Case Range("J4").Value '1 investigation Case 1 Call Investigation_2_Close Call Investigation_3_Close '2 investigations Case 2 Call Investigation_2_Open Call Investigation_3_Close '3 investigations Case 3 Call Investigation_2_Open Call Investigation_3_Open End Select End Sub 'Open investigation 2 Sub Investigation_2_Open() Rows("57:74").Hidden = False Range("H57").Value = "=SUM(H58:H61)" Range("I57").Value = "=SUM(I58:I61)" Range("H64").Value = "=SUM(H65:H72)" Range("I64").Value = "=SUM(I65:I72)" End Sub
Any help would be great.
Attachment included to help. The error is encountered any time the dropdown box is changed.
Bookmarks