Hi all,
I'm currently in a new 'phase' of my excel career: connecting a cell(variable) with a pivot table filter using a macro.
I've been looking around for quite a while and testing a few macro's but nothing worked out yet.. I would be great if you guy's could help me out!
Could someone help me to write the right macro to filter a pivot based on 3 criteria's? (attachment for more detail)
Macro to change one pivot filter based on datainput from another cell
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("D4")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Dim Field As PivotField
Dim NewCat As String
Set pt = Worksheets("Pivots").PivotTables("PivotTable9")
Set Field = pt.PivotFields("Ship To Postal Code")
NewCat = Worksheets("Pivots").Range("D4").Value
Field.ClearAllFilters
Field.CurrentPage = NewCat
pt.RefreshTable
End With
End Sub
Thanks you so much in advance!
Cheers
DavidPivot filters.xlsx
Bookmarks