View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pkern pkern is offline
external usenet poster
 
Posts: 10
Default Newbie code not working

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