Solved

Two Pivot Tables, one dependent on the other

Posted on 2014-03-13
4
34 Views
Last Modified: 2016-05-22
I have two tabs with a pivot table each in an MS Excel 2007 spreadsheet from the same data source.   Specifically, I have date (MMMYYYY) filter at the top of the 1st tab and another Date filter on the second tab.

How do I connect the two.  I.e., if I select a date in the 1st tab, say AUG2014, how can I relay that select to the pivot table in the second tab?

Thanks,
0
Comment
Question by:dragonhearts
4 Comments
 
LVL 19

Expert Comment

by:helpfinder
ID: 39927320
In 2007 you can use only VBA (macro) for this. If you can use Office 2010 or 2013 there is a feature called Slicers which is somethig you can use for this
0
 

Author Comment

by:dragonhearts
ID: 39935318
Sorry, for now, IT has only allowed us to use 2007. Given such, what is the VB macro I can use?
0
 
LVL 28

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
ID: 40898197
You may try something like this to see if this works for you.
Don't forget to change the Sheet Names and PivotTable Names as per your actual sheet names and PivotTable Names before running the code.
Sub SetSameFilterInPivotTables()

Dim ws1 As Worksheet, ws2 As Worksheet
Dim myFilter As String

Set ws1 = Sheets("Pivot1")          'Pivot1 is the Sheet which has the PivotTable1

Set ws2 = Sheets("Pivot2")          'Pivot2 is the Sheet which has the PivotTable2

myFilter = ws1.PivotTables("PivotTable1").PivotFields("Date").CurrentPage.Value         'Date is the field name which is dropped in PivotTable Filter Area and myFilter is the filter set in PivotTable1

ws2.PivotTables("PivotTable2").PivotFields("Date").ClearAllFilters          'Clears all the existing Filters from PivotTable2

ws2.PivotTables("PivotTable2").PivotFields("Date").CurrentPage = myFilter

End Sub

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now