I have a WB and I have tried several methods/codes to have my pivot table filter according to the numeric value in another sheet but no success.
The cell that contains the value is on sheet "Demographics Summary" and is E5
The pivot table is named PivotTable1 and is on "pivot" sheet, the filter field is named "Location"
I tried the below code in the "Demographics Summary" sheet module:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim pvt As PivotTable
If Union(Target, Range("K1")).Address = Range("K1").Address Then
For Each pvt In ActiveSheet.PivotTables
pvt.PivotFields("Type").CurrentPage = Range("K1").Value
Next
End If
End Sub
And to the right of my pivot table entered:
='Demographics Summary'!E5
This was one of many codes but looked like it was simple and would work but it's not. Any ideas?
Bookmarks