PDA

View Full Version : Master Filter for Pivot Tables



forrestgump
07-21-2011, 03:47 AM
Hi All,

I am trying to create a master filter on the 1st sheet of an excel workbook so that when I change the first filter it changes all the pivot tables. I am currently using the following vba code:-

Public Sub Update_PTs()
Dim PT As PivotTable, ws As Worksheet
Dim vChoice: vChoice = Sheets("MASTER").Range("A1")
For Each ws In ThisWorkbook.Worksheets
For Each PT In ws.PivotTables
PT.PageFields(1).CurrentPage = vChoice
Next PT
Next ws
End Sub

However, when I use this code I get run time error 1004 and the code stops at line "PT.PageFields(1).CurrentPage = vChoice".

How can I fix this?

Regards,

ForrestGump