I want the value in a pivot report filter to be the same as a value in a cell on another sheet. When the value on the other sheet changes I want the value of the report filter to change to match this value.
I have some code (from the web) that works, but only if you click on the sheet that has the pivot table in it. I want the pivot table to update without having to click on the sheet.
Code is as follows:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim pt As PivotTable
Dim Field As PivotField
Dim NewCat As String
Set pt = Worksheets("IndRegEmpPivot").PivotTables("PivotTable2")
Set Field = pt.PivotFields("SA4 Code")
NewCat = Worksheets("IndRegEmpPivot").Range("aa100").Value
With pt
Field.ClearAllFilters
Field.CurrentPage = NewCat
pt.RefreshTable
End With
End Sub
Any help would be greatly appreciated. Thanks.
Bookmarks