G
Guest
I need to select range for pivot table command.
If I select a range and then record a macro I get this for the pivot command:
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"TempEC!R1C1:R229C50").CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
Now I need to put a similar pivot table command into a macro program, and I
don't know how to reference the SourceData in the pivot command.
I tried using the name of a range I defined earlier in the macro, but get an
error.
I also tried using RC notation given the row and column size of the
datasource.
If I select a range and then record a macro I get this for the pivot command:
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"TempEC!R1C1:R229C50").CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
Now I need to put a similar pivot table command into a macro program, and I
don't know how to reference the SourceData in the pivot command.
I tried using the name of a range I defined earlier in the macro, but get an
error.
I also tried using RC notation given the row and column size of the
datasource.