HI, I have the code below which works fine to update a single pivot table (PivotTable3) which is on Worksheet "P&L Analysis". The sheet "P&L Analysis" contains another two pivot tables named "PivotTable10" and "PivotTable11" which I would also like to update automatically.
Can anyone tell me how to amend the code below please?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("B2:B3")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Dim Field As PivotField
Dim NewCat As String
Set pt = Sheet6.PivotTables("PivotTable3")
Set Field = pt.PivotFields("Period")
NewCat = Worksheets("P&L Analysis").Range("B2").Value
With pt
Field.ClearAllFilters
Field.CurrentPage = NewCat
pt.RefreshTable
End With
End Sub
Thanks in advance
Can anyone tell me how to amend the code below please?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("B2:B3")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Dim Field As PivotField
Dim NewCat As String
Set pt = Sheet6.PivotTables("PivotTable3")
Set Field = pt.PivotFields("Period")
NewCat = Worksheets("P&L Analysis").Range("B2").Value
With pt
Field.ClearAllFilters
Field.CurrentPage = NewCat
pt.RefreshTable
End With
End Sub
Thanks in advance