So I am using this (http://datapigtechnologies.com/flashfiles/pivot10.html) tutorial to synchronize a few pivot tables in one of my workbooks. But it doesn't work correctly because not all my tables have the same values. For example: The matching column name is RepName, and I have multiple tables with RepName as a column, but not all reps are in all tables. I'd like it to select (all) if one of the pivottables does not have a rep. Any help? Excel 2003, but if you guys have a better 2007 code, then I can use 2007.
Sub ChangePivots()
'
' ChangePivots Macro
' Macro recorded 3/21/2012 by config
'
'
ActiveSheet.PivotTables("PT1").PivotFields("SalesRepName").CurrentPage = Range("M1").Text
ActiveSheet.PivotTables("PT4").PivotFields("SalesRepName").CurrentPage = Range("M1").Text
On Error GoTo Err_SomeName2
ActiveSheet.PivotTables("PT2").PivotFields("SalesRepName").CurrentPage = Range("M1").Text
On Error GoTo Err_SomeName2
Pivot3:
On Error GoTo Err_SomeName3
ActiveSheet.PivotTables("PT3").PivotFields("SalesRepName").CurrentPage = Range("M1").Text
On Error GoTo Err_SomeName3
GoTo TheEnd
Err_SomeName2:
ActiveSheet.PivotTables("PT2").PivotFields("SalesRepName").CurrentPage = Range("(All)").Text
Resume Next
Err_SomeName3:
ActiveSheet.PivotTables("PT3").PivotFields("SalesRepName").CurrentPage = Range("(All)").Text
Resume Next
TheEnd:
End Sub
Bookmarks