I have a pivot table containg 65,000+ combinations of "tools" and corresponding "charts"
For instance: Tool 1 may be associated with charts A, B, C, D, E
The pivot table is useful because I can drag and drop the pivot fields, and show that chart A is associated with tools 1, 2, 3, 4, 5
etc.
The actual question:
When I record a macro and select/deselect all items within a pivot field, the macro shows one line of code to manually show or hide EACH individual chart:
With ActiveSheet.PivotTables("PivotTable").PivotFields("Chart")
.PivotItems("A").Visible = True
If I'm trying to use a macro to hide all the charts except for a few which are stored in an array (output from another macro - the selection of charts will vary, thus using VBA to filter based upon a variable and not doing it manually), then I have a macro with thousands of lines of code, and it becomes useless if my selection of charts changes, or the query of 65,000 combinations is updated.
I can't seem to find an easy way to say something like:
Within the PivotField "Chart", hide all (Visible = False) PivotItems except for these: [chart names in my array]
I have been playing around with some loops and might be able to do it, but I also need to minimize how long it takes to macro to scan through 65,000 rows and examine each cell before determining whether or not to hide it. Is there a "PivotItem(All).Visible = False" or something that I am unaware of?
I hope what I'm asking is somewhat clear... I need an easy way to only display a small portion of the 65,000 combinations in my table based upon a selection generated by another macro and stored in an array.
Any advice? Thanks a bunch
Bookmarks