I would like to use vba code to select the field values in the first two columns of my pivot table. For example, if my pivot table is as follows:
COMPANY STATE REVENUE
Nike OR $100
REI WA $50
Columbia OR $25
Grand Total $175
I would like VBA to select the following text.
Nike OR
REI WA
Columbia OR
Here is some code I found online to select one column at a time:
Sheets("Sheet1").Select
Dim Pt As PivotTable
Set Pt = Sheets("Sheet1").PivotTables(1)
Pt.PivotFields("Company").DataRange.Select
I then copy the data to another sheet. I could repeat this for the "State" column, but my real life spreadsheet has a lot more info that I need to copy and paste, so I'd rather copy all the field values at once.
Anyone know how I can select Company and State values at the same time?
Thanks!
COMPANY STATE REVENUE
Nike OR $100
REI WA $50
Columbia OR $25
Grand Total $175
I would like VBA to select the following text.
Nike OR
REI WA
Columbia OR
Here is some code I found online to select one column at a time:
Sheets("Sheet1").Select
Dim Pt As PivotTable
Set Pt = Sheets("Sheet1").PivotTables(1)
Pt.PivotFields("Company").DataRange.Select
I then copy the data to another sheet. I could repeat this for the "State" column, but my real life spreadsheet has a lot more info that I need to copy and paste, so I'd rather copy all the field values at once.
Anyone know how I can select Company and State values at the same time?
Thanks!