Solved

Two Pivot Tables, one dependent on the other

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
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.
Viewers will learn the different options available in the Backstage view in Excel 2013.
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…

919 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

13 Experts available now in Live!

Get 1:1 Help Now