VBA help - an easy question
Try .PivotItems(.PivotItems.Count).Visible = False
HTH
Die_Another_Day
MarkM (at) wrote:
This is probably an easy one but I cannot figure it out. I have a pivot
table that displays data by month. What I want to do is automatically
unselect the last month in the list, so if I refresh my table in the middle
of a month it will not show the current month. In my searching the group for
this answer I was able to find some code that automatically selects all items
within the PivotItem. Which will be useful the following month to ensure I
get all months but the current month. What I need is the code to unselect
the last month in the list. The code I was trying to modify to tell it to
unselect the last month is:
With ActiveSheet.PivotTables("PivotTable2").PivotFields ("Month")
.PivotItems("200607").Visible = False
What do I need to have in place of the ("200607") to have it use the last
month in the list.
Any help is greatly appreciated and thanks in advanced.
|