Solved

Two Pivot Tables, one dependent on the other

Posted on 2014-03-13
4
42 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 31

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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 …

752 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