P
pkern
I'm trying to use one pivot table filter to activate both pivot tables on one
sheet in Excel 2007. Code doesn't seem to be working. Any help would be
greatly appreciated.
Private Sub Worksheet_Calculated()
Dim MvPivotPageValue As Variant
Dim Pt As PivotTable 'main pivot table
Dim Pt1 As PivotTable ' 2nd pivot table
Dim WsOther As Worksheet ' name of worksheet
Dim strField As String ' report filter name
Set WsOther = Sheets("Division Summary1")
Set Pt = PVT1
Set Pt1 = WS.Other.PVT2
Set strField = "Fiscal Calendar"
If LCase(Pt.PivotFields("Fiscal Calendar").CurrentPage) <>
LCase(MvPivotPageValue) Then
Application.EnableEvents = False
Pt.RefreshTable
MvPivotPageValue = Pt.PivotFields(strField).CurrentPage
Pt1.PageFields(strField).CurrentPage = MvPivotValue
Application.EnableEvents = True
End If
End Sub
sheet in Excel 2007. Code doesn't seem to be working. Any help would be
greatly appreciated.
Private Sub Worksheet_Calculated()
Dim MvPivotPageValue As Variant
Dim Pt As PivotTable 'main pivot table
Dim Pt1 As PivotTable ' 2nd pivot table
Dim WsOther As Worksheet ' name of worksheet
Dim strField As String ' report filter name
Set WsOther = Sheets("Division Summary1")
Set Pt = PVT1
Set Pt1 = WS.Other.PVT2
Set strField = "Fiscal Calendar"
If LCase(Pt.PivotFields("Fiscal Calendar").CurrentPage) <>
LCase(MvPivotPageValue) Then
Application.EnableEvents = False
Pt.RefreshTable
MvPivotPageValue = Pt.PivotFields(strField).CurrentPage
Pt1.PageFields(strField).CurrentPage = MvPivotValue
Application.EnableEvents = True
End If
End Sub