Answers please to my query

  • Thread starter Thread starter Ron McCormick
  • Start date Start date
R

Ron McCormick

I posted this earlier in the day with a different subject
heading (including the word "Pivot Table"). Is "Pivot
Table" a phrase that Excel Programmers choke on? I have
posted several questions over a period of time on Pivot
Tables and none has received any response. Even a
direction as to where I can get help if this list can't
help would be a great help!!!!

Anyhow the real question is:

I wish to copy a pivot table report and name
it "PivotTable_2". How do I do this programmatically? I
tried recording a macro and came up with the following:

ActiveSheet.PivotTables("PivotTable1").PivotSelect "",
xlDataAndLabel
Selection.Copy
Application.Goto Reference:="Target_Region"
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.PivotTables("PivotTable8").Name
= "PivotTable_2"

The problem is that next time I run the procedure the
Pivot Table to be named "PivotTable_2" is "PivotTable9".
How do I get the table to be "PivotTable8" each time? (If
I knew that I wouldn't actually need to rename it
as "PivotTable_2"!).

TIA
Ron
 
hi mccormick.
you should name a pivot table when its first created.
eg:

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"sheet2dummy!R1C1:R" & rowend & "C" & colend &
"").CreatePivotTable TableDestination:="", TableName:= _
"sheetxpivot", DefaultVersion:=xlPivotTableVersion10









sheetxpivot
 
See one response at your other post.

Ron said:
I posted this earlier in the day with a different subject
heading (including the word "Pivot Table"). Is "Pivot
Table" a phrase that Excel Programmers choke on? I have
posted several questions over a period of time on Pivot
Tables and none has received any response. Even a
direction as to where I can get help if this list can't
help would be a great help!!!!

Anyhow the real question is:

I wish to copy a pivot table report and name
it "PivotTable_2". How do I do this programmatically? I
tried recording a macro and came up with the following:

ActiveSheet.PivotTables("PivotTable1").PivotSelect "",
xlDataAndLabel
Selection.Copy
Application.Goto Reference:="Target_Region"
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.PivotTables("PivotTable8").Name
= "PivotTable_2"

The problem is that next time I run the procedure the
Pivot Table to be named "PivotTable_2" is "PivotTable9".
How do I get the table to be "PivotTable8" each time? (If
I knew that I wouldn't actually need to rename it
as "PivotTable_2"!).

TIA
Ron
 
Back
Top