Solved

Two Pivot Tables, one dependent on the other

Posted on 2014-03-13
4
39 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 29

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

810 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