Skip to content

Instantly share code, notes, and snippets.

@chrisgemignani
Created January 26, 2009 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisgemignani/52843 to your computer and use it in GitHub Desktop.
Save chrisgemignani/52843 to your computer and use it in GitHub Desktop.
' 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