I am attempting to create a macro that will create a custom date Filter that will mimic the selection of "date filter/after". Below is the code developed from using the macro recorder:
ActiveSheet.PivotTables("Results").PivotFields("Original Date"). _
ClearAllFilters
ActiveSheet.PivotTables("Results").PivotFields("Original Date"). _
PivotFilters.Add Type:=xlAfter, Value1:="10/1/2014"
What I am after is to subsitute the "10/1/2014" date with an entry that will calculate the start date as 60 days prior to todays date. The example below errors - what am I doing wrong?
ActiveSheet.PivotTables("Results").PivotFields("Original Date"). _
ClearAllFilters
ActiveSheet.PivotTables("Results").PivotFields("Original Date"). _
PivotFilters.Add Type:=xlAfter, Value1:="=TODAY()-60"
ActiveSheet.PivotTables("Results").PivotFields("Original Date"). _
ClearAllFilters
ActiveSheet.PivotTables("Results").PivotFields("Original Date"). _
PivotFilters.Add Type:=xlAfter, Value1:="10/1/2014"
What I am after is to subsitute the "10/1/2014" date with an entry that will calculate the start date as 60 days prior to todays date. The example below errors - what am I doing wrong?
ActiveSheet.PivotTables("Results").PivotFields("Original Date"). _
ClearAllFilters
ActiveSheet.PivotTables("Results").PivotFields("Original Date"). _
PivotFilters.Add Type:=xlAfter, Value1:="=TODAY()-60"