Hello Everybody,
I have below code which allows to change Pivot Filter for one pivot based on a cell value.
Can you please assist me to alter this macro to change multiple Pivots based on same cell value.
Note: All pivots are created from same database.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xPTable As PivotTable
Dim xPFile As PivotField
Dim xStr As String
On Error Resume Next
If Intersect(Target, Range("I1")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xPTable = Worksheets("Sheet1").PivotTables("PivotTable1")
Set xPFile = xPTable.PivotFields("POS")
xStr = Target.Text
xPFile.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
End Sub
Regards,
Shan
I have below code which allows to change Pivot Filter for one pivot based on a cell value.
Can you please assist me to alter this macro to change multiple Pivots based on same cell value.
Note: All pivots are created from same database.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xPTable As PivotTable
Dim xPFile As PivotField
Dim xStr As String
On Error Resume Next
If Intersect(Target, Range("I1")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xPTable = Worksheets("Sheet1").PivotTables("PivotTable1")
Set xPFile = xPTable.PivotFields("POS")
xStr = Target.Text
xPFile.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
End Sub
Regards,
Shan