Results 1 to 2 of 2

VBA commands to filter pivot tables

Threaded View

  1. #1
    Registered User
    Join Date
    06-27-2013
    Location
    New Hampshire, USA
    MS-Off Ver
    Excel 2010
    Posts
    25

    VBA commands to filter pivot tables

    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
    Last edited by ALN1991; 07-11-2013 at 10:14 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1