Copying Pivot Tables on to one sheet using VBA

WildfireS3

New Member
Joined
Nov 20, 2009
Messages
11
Hi All

I'm a beginner to VBA, so please be gentle.

I have realsied that I can speed up a lot of my reports by automating them using VBA. However I'm a complete novice.

I have managed to get Excel to kick out 13 pivot tables to indivdual sheets, but now I want to consolidate these into one sheet.

I would like to copy the pivot table from each sheet, place it on to a new sheet, count 6 cells down then paste the next one in. So I end up with a master sheet with all 13 pivot tables on it.


Any takers?

Thanks
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

WildfireS3

New Member
Joined
Nov 20, 2009
Messages
11
Hi Adam

That would be good, but I'm not sure how to get Excel to find the last cell, in the last pivot table on the sheet, count 6 cells down then create the new pivot table.

Thanks
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
You can use the PivotTable's TableRange2 property like this:

Code:
Sub Test()
    With ActiveSheet.PivotTables(1).TableRange2
        MsgBox .Cells(.Rows.Count, 1).Address
    End With
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,480
Messages
5,601,911
Members
414,482
Latest member
morkar

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
Top