Hi,
I am trying to write a macro that will create a pivot table from a list in an excel worksheet. The list will change in size every time I want the macro run.
Range("B125".Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _"'3M'!R1C2:R25C4".CreatePivotTable TableDestination:="", TableName:= _"PivotTable1"
This is the part of the macro I have a problem with - If x and y is the top left corner of the list, and xx and yy is the bottom right corner of the list, then Range(Cells(y,x),Cells(yy,xx)).Select should replace the first line...but how do I change the 'SourceData' property to reflect variables instead of constants?
TIA
Ross
I am trying to write a macro that will create a pivot table from a list in an excel worksheet. The list will change in size every time I want the macro run.
Range("B125".Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _"'3M'!R1C2:R25C4".CreatePivotTable TableDestination:="", TableName:= _"PivotTable1"
This is the part of the macro I have a problem with - If x and y is the top left corner of the list, and xx and yy is the bottom right corner of the list, then Range(Cells(y,x),Cells(yy,xx)).Select should replace the first line...but how do I change the 'SourceData' property to reflect variables instead of constants?
TIA
Ross