selection of all items in pivot table

amkumar

New Member
Joined
Apr 5, 2016
Messages
45
Hi,

i have a data contain 25 column. when i run a pivot table i need all these columns in rows tab (in pivot table)
is this possible to select all items from pivot fields list in a time. (just like select all)

screenshot is attached where i have select 4 headers....Data1...Data2...Data3....Data4... but my need is to select all items from choose field to Rows in a time.
 

Attachments

  • Capture.JPG
    Capture.JPG
    80.1 KB · Views: 4

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
This code seems to do what you asked for:

Code:
Option Explicit

Sub AddAllDataToRowFields()
    Dim pf As PivotField
    For Each pf In ActiveSheet.PivotTables(1).PivotFields
        If Left(pf.Name, 4) = "Data" Then
            With ActiveSheet.PivotTables(1).PivotFields(pf.Name)
                .Orientation = xlRowField
            End With
        End If
    Next
End Sub

Sub RemoveAllDataFromRowFields()
    Dim pf As PivotField
    For Each pf In ActiveSheet.PivotTables(1).PivotFields
        If Left(pf.Name, 4) = "Data" Then
            With ActiveSheet.PivotTables(1).PivotFields(pf.Name)
                .Orientation = xlHidden
            End With
        End If
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,309
Members
448,564
Latest member
ED38

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