Hi,
I am trying to create two worksheet selection changes on the same sheet that will change the filters of a pivot table on another sheet. My first one is working perfectly when I change cell B2, but the second does nothing when i make a change to cell B1. The filters they are trying to change are SIOP Model (this one is working) and SIOP Platform( no change when i change the value of this cell). Below is my code.
I appreciate any help!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("B2")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Dim Field As PivotField
Dim NewCat As String
Set pt = Worksheets("Pivotw2014").PivotTables("PivotTable2")
Set Field = pt.PivotFields("SIOP Model")
NewCat = Worksheets("Results").Range("B2").Value
With pt
Field.ClearAllFilters
Field.CurrentPage = NewCat
End With
End Sub
Private Sub Worksheet_SelectionChange2(ByVal Target As Range)
If Intersect(Target, Range("B1")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Dim NewCat As String
Set pt = Worksheets("Pivot2014").PivotTables("PivotTable2")
Set Field = pt.PivotFields("SIOP Platform")
NewCat = Worksheets("Results").Range("B1").Value
With pt
Field.ClearAllFilters
Field.CurrentPage = NewCat
End With
End Sub
Bookmarks