View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
smartin smartin is offline
external usenet poster
 
Posts: 915
Default Items in Report Filter of PivotTable not "checked" automatical

Whoops! I broke the context of the With statement. Try this instead:

Application.ScreenUpdating = False
Worksheets("Paid").PivotTables("PivotTable1").Pivo tCache.Refresh
With Worksheets("Paid").PivotTables("PivotTable1").Pivo tFields("CPR NO#")
For x = 1 To .PivotItems.Count
..PivotItems(x).Visible = True
Next
..PivotItems("(blank)").Visible = False
End With
Application.ScreenUpdating = True
End Sub


smartin wrote:
Good find! I wonder if the Auto_Open code fires before the PT refreshes
itself.

What you could try is inserting a command to force the PT to refresh first:


</code zapped

shabutt wrote:
After a lot of search on web I came across this code on
"www.dailydoseofexcel.com" and modified for my situation.

Sub Auto_Open()

Application.ScreenUpdating = False
With Worksheets("Paid").PivotTables("PivotTable1").Pivo tFields("CPR NO#")
For x = 1 To .PivotItems.Count
.PivotItems(x).Visible = True
Next
.PivotItems("(blank)").Visible = False
End With
Application.ScreenUpdating = True
End Sub