Hi there!
I'm trying to write a macro that allows users to control the date filter on a pivot table by entering a start and end date into 2 cells. They then click a button that triggers the macro.
The code I have so far is:
Sub DateFilter()
Sheets("TC1 By Panel").PivotTables("PivotTable1").PivotFields("Faults").ClearAllFilters
Sheets("TC1 By Panel").PivotTables("PivotTable1").PivotFields("Time Painted").PivotFilters _
.Add Type:=xlDateBetween, Value1:=Range("E3").Value, Value2:=Range("F3").Value
End Sub
This doesn't work, i get 'Application-defined or object-defined error'
I have also heard that this only works with the date format 'mm/dd/yyyy' so I have tried dates in that format and still no luck.
Any help would be greatly appreciated!
Adam
Bookmarks