Remove all Pivot table rows

Molden

Active Member
Joined
Jun 20, 2006
Messages
373
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
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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!
 
Upvote 0

Forum statistics

Threads
1,214,530
Messages
6,120,071
Members
448,943
Latest member
sharmarick

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top