Consulting

Results 1 to 5 of 5

Thread: Pivot Table Show All

  1. #1

    Pivot Table Show All

    How would I reset a pivot table to that it shows all of the items without using loops? Currently, I am using a loop to go through each list and select all the items. This however takes an extremely long time. I have tried using .showAllItems = True but it doesn't seem to work. Any advice?

  2. #2
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    You're right, ShowAllItems = useless! I believe 2007 has a ClearAllFilters option for the pivot field, but for 2003 try this

    [VBA]
    Dim pvt As PivotTable
    Dim pvtFld As PivotField
    Dim pvtItm As PivotItem

    Application.Calculation = xlCalculationManual
    On Error Resume Next

    Set pvt = ActiveSheet.PivotTables("pvtControlBox")
    pvt.ManualUpdate = True

    For Each pvtFld In pvt.PivotFields
    ' doesn't work!!!
    pvtFld.ShowAllItems = True

    For Each pvtItm In pvtFld.PivotItems
    pvtItm.Visible = True
    Next pvtItm
    Next pvtFld

    pvt.ManualUpdate = False
    Application.Calculation = xlCalculationAutomatic
    [/VBA]

  3. #3
    Thank you for your reply GeekGirlAu. I ran your code but it still look a very long time to run as I have lots of items in a few of my fields. I think the issue is becuase it is a loop within a loop. Is there a way where I can just select the "Show All" item instead of going through each item and manually selecting it?

    Oh yes, and I am running Office 2003.

  4. #4
    Moderator VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    This is the only method I could find. Setting ManualUpdate to True improved the performance somewhat, but only to a degree.

  5. #5
    I tested my code with and without manual update. They both took ~3 min give or take a second.

    Thank you though

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •