KMacattack
New Member
- Joined
- Nov 24, 2008
- Messages
- 11
I am getting a Runtime Error 1004: Unable to set the Hidden property of the Range class
I have a macro that updates a bunch of pivot tables based on selections from data validation dropdowns.
(this works fine)
Based on the users selections I want to hide and unhide various rows.
i do this in two steps:
from the code to update the pivot table:
goes to a function to specify the which rows to hide or unhide (collapse):
The Unhide and Hide are separate functions.
And when the code gets to the unhide 13,200 function i get that error.
My workbook is unprotected and unlocked: as i found in many other forms that was the problem.
the other thing is that it sometimes works and other times doesn't and i can't pinpoint the situation that makes it happen.
so if anyone has a fix or reason for this please help.
Thank You
Mac
I have a macro that updates a bunch of pivot tables based on selections from data validation dropdowns.
(this works fine)
Based on the users selections I want to hide and unhide various rows.
i do this in two steps:
from the code to update the pivot table:
goes to a function to specify the which rows to hide or unhide (collapse):
Code:
Public Sub Collapse()
Sheets("Exhibit").Activate
'Unhide all rows
UnHide 13, 200
'hide/unhide month
'Hides the Months after the month given in Cell A5
hide 16 + (Month(Sheets("Exhibit").Range("A5"))), 28
End If
< ... there is more of similar code below ... >
End sub
The Unhide and Hide are separate functions.
Code:
Sub hide(R1, R2)
'Hides rows R1 to R2 in Exhibit Tab
ActiveSheet.Rows(R1 & ":" & R2).Hidden = True
End Sub
---------------------------------------------------------
Sub UnHide(R1, R2)
'Unhides Rows R1 to R2 in Exhibit Tab
ActiveSheet.Rows(R1 & ":" & R2).Hidden = False
End Sub
And when the code gets to the unhide 13,200 function i get that error.
My workbook is unprotected and unlocked: as i found in many other forms that was the problem.
the other thing is that it sometimes works and other times doesn't and i can't pinpoint the situation that makes it happen.
so if anyone has a fix or reason for this please help.
Thank You
Mac