I'm trying to use VBA to copy the Total column from a dynamic pivot table but keep getting an error.
Here is my code:
MyPivotTable.PivotFields("Name").PivotItems("Grand Total").DataRange.Copy
Sheets("Sheet 1").Range("A1").PasteSpecial xlPasteValues
This approach works fine for normal columns in the pivot table, but doesn't seem to work for the Sum column labelled "Grand Total". Do I need to refer to this column differently?
Many thanks
Here is my code:
MyPivotTable.PivotFields("Name").PivotItems("Grand Total").DataRange.Copy
Sheets("Sheet 1").Range("A1").PasteSpecial xlPasteValues
This approach works fine for normal columns in the pivot table, but doesn't seem to work for the Sum column labelled "Grand Total". Do I need to refer to this column differently?
Many thanks