Created
January 26, 2009 15:38
-
-
Save chrisgemignani/52843 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Add this to the page that contains the master PivotTable | |
' assumes the page containing the slave PivotTables is named "Transform" | |
' | |
' | |
' On PivotTable update in the Display page | |
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable) | |
Dim masterPf As PivotField | |
Dim slavePf As PivotField | |
Dim pt As PivotTable | |
' for each PageField in the master PivotTAble | |
For Each masterPf In Target.PageFields | |
' check all the PivotTables in the transform sheet | |
For Each pt In Worksheets("Transform").PivotTables | |
' if the slave PivotTable contains a PageField | |
' with the same value as the masterPf | |
For Each slavePf In pt.PageFields | |
If slavePf.Value = masterPf.Value Then | |
' make the slave PageField have the same CurrentPage (selected item) | |
' as the master PageField | |
Worksheets("Transform").PivotTables(CStr(pt)).PivotFields(CStr(slavePf)).CurrentPage = CStr(masterPf.CurrentPage) | |
End If | |
Next slavePf | |
Next pt | |
Next masterPf | |
End Sub | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment