+ Reply to Thread
Results 1 to 3 of 3

Set Pivot Table Filters across Worksheets

  1. #1
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    75

    Set Pivot Table Filters across Worksheets

    I am attempting to set up a macro that will cycle through the worksheets in my file and update my pivot tables.

    The below code will cycle through each worksheet and each pivot table:

    Please Login or Register  to view this content.
    the next step is where I'm having issues. I want to update two filters on each pivot table (all the same) . I attempted to record a macro to figure out how to get it done, but can't figure out how to incorporate it into my for /next loops:
    Please Login or Register  to view this content.
    I get the error "Method 'PivotTables' of object'_worksheet' failed." when I try the below code:
    Please Login or Register  to view this content.

    any guidance is appreciated.

  2. #2
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Set Pivot Table Filters across Worksheets

    Ok,

    SO I've partially figured out my issue. I can't utilize the following code:
    Please Login or Register  to view this content.
    I have to set a variable and use that variable in my code as such:
    Please Login or Register  to view this content.
    my follow up question is regarding the filters. How do I deselect all the options I don't want and just the ones listed in the code above. the only way I've found thus far is to set the .Visible property to False, but I don't know what values may or may not be in the filter to set them to False...

    I tried
    Please Login or Register  to view this content.
    but got an error.

    Anyone have insight on clearing filters

  3. #3
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: Set Pivot Table Filters across Worksheets

    So I have a 99% solution coded below:

    Please Login or Register  to view this content.
    The issue I'm still working on is in the For Loop. It won't uncheck the last item in each filter. For the first filter, it's not currently an issue since the last item is an item I want included anyway. for the last filter, I had to hard code turning off #VALUE! hoping it will always be the last item in the list.

    Is there a function that can select the last filter item? This way, I could run the code listed above, setting the .Visible = True tags (or just one of them) to the one(s) I want, unselect the last item in the filter list, then reapply the .Visible = True code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Speed up creating worksheets for all filters in pivot table
    By hdinkie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2016, 08:01 AM
  2. Replies: 1
    Last Post: 07-16-2015, 05:46 AM
  3. Pivot Table Filters
    By marcrist in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-01-2014, 06:39 AM
  4. [SOLVED] Pivot Table filters
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-06-2013, 05:35 AM
  5. [SOLVED] What filters to use in pivot table
    By glenath in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-24-2013, 01:04 AM
  6. [SOLVED] Pivot Table Filters
    By gsmcconville in forum Excel General
    Replies: 0
    Last Post: 04-13-2012, 05:31 AM
  7. VBA for Pivot Table Filters
    By Coldsteel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-28-2010, 09:03 AM

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