ChadElzinga
Programmer
I've written a little script to restrict the PivotItems that are visible for a specific PivotField by iterating through the pivot items and setting their visibility to false if they don't fall within a user specified range. The code currently looks something like this...
Application.ScreenUpdating = False
items = Sheet1.PivotTables(1).PivotField("Date"
.PivotItems
itemCount = items.Count
For counter = 1 To itemCount
currentValue = CDate(loItems(llCounter).Value)
If ("currentValue within range"
Then
items.Item(counter).Visible = True
Else
items.Item(llCounter).Visible = False
End If
counter = counter + 1
Next
Application.ScreenUpdating = True
This is functional, but I think it's still doing the screen calculations in the background every time I set a PivotItem to visible or hidden. I was wondering if anybody out there knew how I could change a bunch of the PivotItems before it updated the spreadsheet like it does with the PivotField dropdowns?
Thank you,
Chad Elzinga
Application.ScreenUpdating = False
items = Sheet1.PivotTables(1).PivotField("Date"
itemCount = items.Count
For counter = 1 To itemCount
currentValue = CDate(loItems(llCounter).Value)
If ("currentValue within range"
items.Item(counter).Visible = True
Else
items.Item(llCounter).Visible = False
End If
counter = counter + 1
Next
Application.ScreenUpdating = True
This is functional, but I think it's still doing the screen calculations in the background every time I set a PivotItem to visible or hidden. I was wondering if anybody out there knew how I could change a bunch of the PivotItems before it updated the spreadsheet like it does with the PivotField dropdowns?
Thank you,
Chad Elzinga