VBA with PivotTables

MPFraser7

New Member
Joined
Dec 14, 2016
Messages
34
I have two workbooks, each containing a pivot table. The two pivot tables contain the same fields, but the values are different. What I'm trying to do is use VBA to add Fields to "Rows", one at a time. So let's say the pivot tables have 5 fields: Dollars, Account, Activity, Category, Category 2. I would manually put Dollars in "Values" and Account in "Columns" and I'm not looking to automate this part. Starting with the 3rd field, Activity, I want to bring it in the "Rows" using VBA. When I'm done with that field, I want to use VBA to bring the next one in the list which would be Category. Preferably this code would skip over fields that are already brought in the report, so it would skip over Dollars and Account if they were sorted after Category, for example. The vba would do it for the two pivot tables. The goal of this is to facilitate reconciling the values of two pivot tables in two separate workbooks. If it's easier, I could put the pivot tables in the same workbook, in different sheets. I'm looking forward to hearing your suggestions.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Workbook Name[/TD]
[TD]Sheet Name[/TD]
[TD]PivotTable Name[/TD]
[/TR]
[TR]
[TD]Production[/TD]
[TD]Sheet1[/TD]
[TD]PivotTable1[/TD]
[/TR]
[TR]
[TD]Testing[/TD]
[TD]Sheet1[/TD]
[TD]PivotTable1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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