Help with Pivote Table

  • Thread starter Thread starter Ola2B
  • Start date Start date
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.
 
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
 
Back
Top