Niraj Baraili
Member
Hi Experts,
I am trying to apply filter pivottable based on a cell value as below but my code is not working and it's throwing up error 1004.
Any input on this is appreciated ?
I am trying to apply filter pivottable based on a cell value as below but my code is not working and it's throwing up error 1004.
Any input on this is appreciated ?
Code:
Worksheets(1).Activate
Dim pt As PivotTable
Dim Field As PivotField
Dim rValTL As String
Set pt = Worksheets(1).PivotTables("pivottable4")
Set Field = pt.PivotFields("Date")
rValTL = Wb2.Sheets("Macro").Range("K1").Value
With pt
Field.ClearAllFilters
Field.CurrentPage = rValTL
pt.RefreshTable
End With