Travis Frank
New Member
I am trying to update 2 pivot table filters based on a value I enter into a cell. I was able to find the code to perform this for a single pivot table But I would like to have both pivot table update. Any help is greatly appreciated.
WorkSheet: Pivot Tables
PivotTable#1: "LeadTime"
PivotTable#2: "Usage"
PivotField#1: "MCHP#"
PivotField#2: "MCHP #"
WorkSheet: Pivot Tables
PivotTable#1: "LeadTime"
PivotTable#2: "Usage"
PivotField#1: "MCHP#"
PivotField#2: "MCHP #"
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Update by Extendoffice 20180702
Dim xPTable As PivotTable
Dim xPFile As PivotField
Dim xStr As String
On Error Resume Next
If Intersect(Target, Range("A1:A2")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xPTable = Worksheets("Pivot Tables").PivotTables("LeadTime")
Set xPFile = xPTable.PivotFields("MCHP#")
xStr = Target.Text
xPFile.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
End Sub