Help with Pivote Table

O

Ola2B

I have just recorded a macro to create a pivote table. The problem is,
everytime i run the macro a new worksheet is created. What do I have
to change in the macro code to direct the pivote table to be created
in an exiting worksheet (pre-named) instead of setting up new
worksheet everytime I activated the macro button.

Many thanks,
Ola.
 
G

Guest

CODE (substitute appropriate range, sheet name, workbookname, PivotTableName):

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"sheet1!R1C1:R10C10").CreatePivotTable TableDestination:= _
"[book1.xls]SheetName!R1C1", TableName:="PivotTableName", _
DefaultVersion:=xlPivotTableVersion10


-or-

while recording the macro:
in Step 3 of 3 in the Pivot Table wizard, select "Existing worksheet" and
choose where you want the pivot table to go
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top