+ Reply to Thread
Results 1 to 2 of 2

VBA shortcut to control Pivot Table

Hybrid View

  1. #1
    Registered User
    Join Date
    07-23-2004
    MS-Off Ver
    2007
    Posts
    94

    VBA shortcut to control Pivot Table

    Hi all,

    Please can someone tell me if there is a way to uncheck all items in a pivot table row label selection without listing each item (There are a lot of items).
    Ive been using the below code to remove my blanks from my reports but I need now to uncheck everything (then check on a single item).
    Hope that makes sense

    Thanks
    With ActiveSheet.PivotTables("PMA4").PivotFields("Rep Month")
    .PivotItems("(blank)").Visible = False
    End With

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,449

    Re: VBA shortcut to control Pivot Table

    You have to loop through the items.
    http://www.contextures.com/xlPivot03.html#ShowItem

    this will display only (blank) item. There is not error trapping to handle all items being made invisible, see example in above link for more info

        Dim ptItem As PivotItem
        With ActiveSheet.PivotTables("PMA4").PivotFields("Rep Month")
            For Each ptItem In ptField.PivotItems
                ptItem.Visible = ptItem.Value = "(blank)"
            Next
        End With
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1