Record macro for Pivot Table

normpam

Active Member
Joined
Oct 30, 2002
Messages
355
I am doing a simple 'record' of doing a basic Pivot Table, but when I run the recorded macro on the same sheet with the same data, I get the following code highlighted as being a problem:
Is there something special that needs to be done in order to record a basic Pivot Table macro?
Thanks!

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"working copy (2)!R1C1:R70C4", Version:=7).CreatePivotTable TableDestination _
:="working copy (2)!R3C6", TableName:="PivotTable2", DefaultVersion:=7
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Searched around for quite a while and found a solution....
Need to change TableDestination _:="working copy (2)!R3C6" to have an apostrophe surrounding the sheet name

TableDestination _
:="'working copy (2)'!R3C6"
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,094
Latest member
bsb1122

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