View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
kelly gardner kelly gardner is offline
external usenet poster
 
Posts: 1
Default Pivot Table Filtering - Macro

Hi,
I am trying to filter a pivot table through a macro and what I have works but I have come to find out that the source data is more dynamic than I thought and is breaking my macro each month I run it. Here is a small exerpt of what I have so far:

ActiveSheet.PivotTables("PivotTable").PivotFields( "Project ID").CurrentPage = _"(All)"

'Filter for KT Hours
With ActiveSheet.PivotTables("PivotTable").PivotFields( "Project ID")
.PivotItems("7012276").Visible = False
.PivotItems("7012279").Visible = False
.PivotItems("2012314").Visible = False
.PivotItems("5012315").Visible = False
.PivotItems("4012335").Visible = False
.PivotItems("2174974").Visible = True
.PivotItems("1174975").Visible = True
.PivotItems("4012323").Visible = False
.PivotItems("4012433").Visible = False
.PivotItems("4013422").Visible = False