Hello again!!
Just wondering if someone could help me out. I have a pivot table containing a large amount of data. My date field is inside the row area. I would like to filter the dates to contain only those dates to include only the information for the past 60 months. Currently I am working on a code like this:
'Declare variable
Dim Pfield As PivotField
'Set variable as pivot table
Set Pfield = Sheets("DB Pivot Table").PivotTables("DB Pivot Table").PivotFields("Date")
'Clear current Filters
Pfield.ClearAllFilters
'Filter for dates
Pfield.PivotFields("Accident Month").PivotFilters.add Type:=xlDateAfter, _
Value:=wholeEndDate - 60
wholeEndDate is a string made from user input to create today's date. The value looks like this: "05/31/2019".
Unfortunately this is not working. Any help is much appreciated!!
Dome
Bookmarks