+ Reply to Thread
Results 1 to 3 of 3

Clearing row labels in a pivot table

Hybrid View

FindAnswers Clearing row labels in a... 11-01-2012, 03:30 PM
AlphaFrog Re: Clearing row labels in a... 11-01-2012, 04:57 PM
FindAnswers Re: Clearing row labels in a... 11-07-2012, 03:04 PM
  1. #1
    Registered User
    Join Date
    08-21-2012
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    10

    Clearing row labels in a pivot table

    I am trying to create 5 different macros with respective buttons at the top of the PivotTable screen that say Category, SubCat, Brand, SubBrand, and SKU. Whenever I click Category I want excel to bring only the category into the row labels section, when I click SubCat I want SubCat in the row labels section, etc.

    I have recorded all 5, but when switching back and forth between the buttons, it does not clear the row label that was there before.

    Is there VBA code or something I can put before each macro to clear the existing row labels section, so only the row I want to be included will show?

    Or is there a simple function that says "clear row labels?"

    I appreciate the help!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,652

    Re: Clearing row labels in a pivot table

    Something like this will clear all the row labels...
        Dim pf As PivotField
        For Each pf In ActiveSheet.PivotTables("PivotTable1").PivotFields
            If pf.Orientation = xlRowField Then pf.Orientation = xlHidden
        Next pf

  3. #3
    Registered User
    Join Date
    08-21-2012
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Clearing row labels in a pivot table

    Thank you so much that works perfectly!

+ 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