Hello,
Can someone help me combine the codes below into a single event?. I'm trying to control two pivot table filters, Agent and Month based on two separate ranges D6:E6 and D7:E7 . I was able to get a macro to work in one of the ranges but I have no idea on how to include both in the same code.
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("D6:E6")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xPTable = Worksheets("Scorecard").PivotTables("ScoreCard_1")
Set xPFile = xPTable.PivotFields("Agent")
xStr = Target.Text
xPFile.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
End Sub
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("D7:E7")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xPTable = Worksheets("Scorecard").PivotTables("ScoreCard_1")
Set xPFile = xPTable.PivotFields("Month")
xStr = Target.Text
xPFile.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
End Sub
Bookmarks