A
Aaron
My button has this code now to control the Page feild of the PT:
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Month")
.PivotItems("9/30/2006").Visible = False
.PivotItems("10/31/2006").Visible = False
.PivotItems("11/30/2006").Visible = False
.PivotItems("12/31/2006").Visible = False
End With
Thus leaving only the 2007 months visable, thus creating a YTD view. But
when the year flips to 2008 I want the code to automatically Hide all 12
months in 2007 as well. I was thinking maybe I could set all pivotitems in
pivotfeild Month to false if < cell A1 which I could set a formula in. What
would this code look like, or is there a better way?
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Month")
.PivotItems("9/30/2006").Visible = False
.PivotItems("10/31/2006").Visible = False
.PivotItems("11/30/2006").Visible = False
.PivotItems("12/31/2006").Visible = False
End With
Thus leaving only the 2007 months visable, thus creating a YTD view. But
when the year flips to 2008 I want the code to automatically Hide all 12
months in 2007 as well. I was thinking maybe I could set all pivotitems in
pivotfeild Month to false if < cell A1 which I could set a formula in. What
would this code look like, or is there a better way?