I am trying to have the vba update the filters of a pivot table to a specified date range (Start = F1 End = H1)
Currently I can do it with manual dates, but not dates from a cell
Dim PT As PivotTable
Set PT = Sheets("WTDDATA").PivotTables("WTDDATAPIVOT")
With ActiveSheet.PivotTables("WTDDATAPIVOT").PivotFields("ObservationDate")
.PivotItems("9/30/2012").Visible = True
.PivotItems("9/29/2012").Visible = True
.PivotItems("9/28/2012").Visible = True
.PivotItems("9/27/2012").Visible = True
One issue is that it is possible one of the dates in the range is non exhistent (ex 9/01/2012-09/10/2012 filter range but there may be no data for 9/10/2012)
Basically I am looking for something that would do this:
Dim PT As PivotTable
Set PT = Sheets("WTDDATA").PivotTables("WTDDATAPIVOT")
With ActiveSheet.PivotTables("WTDDATAPIVOT").PivotFields("ObservationDate")
.PivotItems("F1") through ("H1").Visible = True
Any help would be greatly appreciated
Bookmarks