I have a Pivot table that has 1 filter " Job number". The filter value I want to use, appears in cell D1. I want the table to filter automatically to the cell D! value, when I open the file. On the Pivot Table options, I have set the Date to Refresh data when opening file.
The table name is "Invoice", and the sheet for the Pivot table and cell D1 is "Cashflow summary"
I don't know why its not working.
Any help would be appreciated. Here is the VBA I have:
Sub UpdatePivotFilter()
Dim NewFilterValue As String
NewFilterValue = Worksheets("Cashflow summary").Range("D1").Value
Worksheets("Cashflow summary").PivotTables("Invoice").PivotFields("Job Number").CurrentPage = NewFilterValue
End Sub
The table name is "Invoice", and the sheet for the Pivot table and cell D1 is "Cashflow summary"
I don't know why its not working.
Any help would be appreciated. Here is the VBA I have:
Sub UpdatePivotFilter()
Dim NewFilterValue As String
NewFilterValue = Worksheets("Cashflow summary").Range("D1").Value
Worksheets("Cashflow summary").PivotTables("Invoice").PivotFields("Job Number").CurrentPage = NewFilterValue
End Sub