I am trying to add additional cols of data to a pivottable. If I record a macro, I get the following line of code.
Adding this line in to a WITH statement results in a missing member error
What is the correctly formatted line to add the extra column of data?
Code:
.PivotTables("LYpd1").AddDataField(.PivotTables("LYpd1").PivotFields("Avg Last year"), "Avg Last Year", .xlSum)
Code:
With ObjXLBook.Sheets("LYpd").PivotTables(1)
.PivotTables("LYpd1").AddDataField(.PivotTables("LYpd1").PivotFields("Avg Last year"), "Avg Last Year", .xlSum)
end with