Using a variable to add fields to a pivot table

G

Gwen

Please assist.

I have a data source that the last 3 of the 12 fields names will change each
time the pivot report is generated.
"This is part of what I have right now to create the report.
ActiveSheet.PivotTables("PivotTable2").AddFields RowFields:=Array("Fld1", _
"Fld2", "Fld3", "Fld4", "Fld5", "Fld6", "Fld7", "Fld8", "Fld9",
"Fld10", "Fld11", _
"Fld12")
How can I change these fields to variables?

And is it possible for my pivot to have fld1 and fld2 subtotals like:

fld3 fld4 fld5 fld6 fld7 fld8 fld9 fld10 fld11 fld12
data data 3 2 4 5 10 2 1 3
data data 1 3 2 1 1 7 4 9
fld2 sum total 4 5 6 6 11 9 5 12
fld1 grand total


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top