View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve Steve is offline
external usenet poster
 
Posts: 1,814
Default remove rows from Pivot Table

I have created a Pivot Table with multiple rows of data for each date.
However, I would like to automate so that only the last 2 days of data is
visible. I am able to get the last 2 days showing but can't seem to automate
removing all the rest of the dates.

vD = FormatDateTime(Now() , 2)
vD1 = FormatDateTime(Now() - 1, 2)

With ActiveSheet.PivotTables("PivotTable2").PivotFields ("Day")
.PivotItems(vD).Visible = True
.PivotItems(vD1).Visible = True
End With