M
mju
I am new to working with pivot table /macro
I have a pivot table. The total columns are always changing.
How do I declare a variable in the data source to find the last used column?
Hard coding it will not help me.
Data can range from A:BD or A:AR. It all depends.
Thanks a lot.
Below is a copy of my code.
CELLS.Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'full'!A:BD").CreatePivotTable TableDestination:="", TableName:= _
"PivotTable4", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.CELLS(3, 1)
ActiveSheet.CELLS(3, 1).Select
With ActiveSheet.PivotTables("PivotTable4")
.ColumnGrand = False
.RowGrand = False
End With
I have a pivot table. The total columns are always changing.
How do I declare a variable in the data source to find the last used column?
Hard coding it will not help me.
Data can range from A:BD or A:AR. It all depends.
Thanks a lot.
Below is a copy of my code.
CELLS.Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'full'!A:BD").CreatePivotTable TableDestination:="", TableName:= _
"PivotTable4", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.CELLS(3, 1)
ActiveSheet.CELLS(3, 1).Select
With ActiveSheet.PivotTables("PivotTable4")
.ColumnGrand = False
.RowGrand = False
End With