+ Reply to Thread
Results 1 to 3 of 3

macro button to update filters and refresh pivot tables in other sheets

  1. #1
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    macro button to update filters and refresh pivot tables in other sheets

    Okay hopefully someone can take a stab at this!!! I have a summary sheet that I would like to be able to change the date on. This date in turn feeds three different pivot tables (call them PivotTable1, PivotTable2, PivotTable3) in three different sheets (call them Sheet1, Sheet2, Sheet3). The field that needs to be affected in each pivot table is "Trade Date". One sheet needs to only filter on that specific date, while the other two need the filter to return every date besides the Date provided. I tried the worksheet specific type of macro and it still required navigating to each separate sheet and updating the date individually, Also for whatever reason it became unstable and crashed the sheet.

    Please Please Please someone help... I've tried finding different solutions and nothing I can find does specifically what I'm looking for...

    I really appreciate your help in advance!!!

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: macro button to update filters and refresh pivot tables in other sheets

    Attach a sample workbook without sensitive data and we may be able to help better. Generally filtering pivot tables involves looping through once to turn everything on and then looping through again to turn off the items you don't want to see.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: macro button to update filters and refresh pivot tables in other sheets

    Used the following code and it works like a charm... actually only needed to update two pivots....


    Sub DeltaFilter()
    Dim CD1 As PivotField
    Dim CD2 As PivotField

    Application.ScreenUpdating = False
    RefreshAllPivotTables

    Set CD1 = Sheet3.PivotTables("PivotTable3").PivotFields("Trade Date")
    Set CD2 = Sheet2.PivotTables("PivotTable6").PivotFields("Trade Date")

    With CD1 'Filter "New Deals" tab
    .ClearAllFilters
    .CurrentPage = Sheets("Summary").Range("G3").Value
    End With

    With CD2 'Filter "Curve Shift" tab
    .ClearAllFilters
    .CurrentPage = "(All)"
    .PivotItems(Sheets("Summary").Range("G3").Value).Visible = False
    .EnableMultiplePageItems = True
    End With

    Sheets("Summary").Activate
    Application.ScreenUpdating = True
    End Sub

+ 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. refresh pivot tables while sheets are protected
    By LeeRichard in forum Excel Charting & Pivots
    Replies: 11
    Last Post: 08-02-2014, 04:24 AM
  2. Macro to Refresh Pivot Tables
    By BLS99covert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2014, 10:48 PM
  3. Macro for linking filters with-in multiple pivot tables
    By Nick Simo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-12-2012, 03:36 PM
  4. Button to update alll pivot Tables
    By chadwellp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2010, 08:21 AM
  5. Button to Refresh to All Pivot Tables
    By manny_cb in forum Excel General
    Replies: 3
    Last Post: 07-18-2008, 01:32 PM
  6. [SOLVED] refresh pivot tables through a macro
    By dolph in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2005, 12:06 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