View Single Post
 
Old 10-09-2011, 01:55 AM
e093223 e093223 is offline Windows XP Office 2007
Novice
 
Join Date: Oct 2011
Posts: 1
e093223 is on a distinguished road
Default VBA: Recording a macro to insert a PIVOT table

Hello!

I am currently learning VBA programming and am trying to do the following:

Record a macro to:
1) Select a set of data
2) Make a pivot table out of it in a new sheet


I have tried doing this, but get an error message. I think this is because I somehow need to make both the new sheet name/number and the new pivot table name/number dynamic? At the moment the code says e.g. "insert sheet 3" and create "pivot table 3", where of course the number will change when I repeat the process? I would want to repeat the process for an unlimited amount of times though without having to change the code every time.

The code runs if you press ctrl-shift-A in the document attached.

I would be really, really grateful for any help!

Thanks!
Attached Files
File Type: xlsm VBAQ_3-3_charts.xlsm (60.9 KB, 14 views)
Reply With Quote