Hi,
I have some code that is trying to update my pivot table, but when I select a dropdown i have to come off it and click the cell to update the data. Please could anyone help? I have searched but cant find anything that matches what I am trying to do. All i want it for it to update when i select one of the dropdowns. The code is below.
Thank you
Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("B3")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Dim Field As PivotField
Dim NewCat As String
Set pt = Worksheets("Pivot").PivotTables("PivotTable1")
Set Field = pt.PivotFields("Month Name")
NewCat = Worksheets("Report").Range("B3").Value
With pt
Field.ClearAllFilters
Field.CurrentPage = NewCat
pt.RefreshTable
End With
End Sub
Bookmarks