Results 1 to 2 of 2

Thread: Remove all Pivot table rows
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jun 2006
    Posts
    372
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Remove all Pivot table rows

    Hi all,

    Does anyone know how to unselect the fields in the rows selection in a pivot table.

    Ive removed all fields in the pivot table but I would like to keep whats in the value and columns?

    Thanks

  2. #2
    MrExcel MVP
    Join Date
    Mar 2004
    Location
    Canada
    Posts
    18,637
    Post Thanks / Like
    Mentioned
    26 Post(s)
    Tagged
    5 Thread(s)

    Default Re: Remove all Pivot table rows

    The following macro assumes that the active sheet contains the pivottable, and that the pivottable is named "PivotTabe1"...

    Code:
    Option Explicit
    
    Sub HideRowFields()
    
    
        Dim pt As PivotTable
        Dim pf As PivotField
        
        Set pt = ActiveSheet.PivotTables("PivotTable1")
        
        For Each pf In pt.PivotFields
            If pf.Orientation = xlRowField Then
                pf.Orientation = xlHidden
            End If
        Next pf
        
        Set pt = Nothing
        Set pf = Nothing
        
    End Sub
    Hope this helps!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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