Pivot table calculated field in data area

K

Kanan

Hi,
I am having an issue with a calculated field. By using a checkbox , I pull
a calculated fied into the data area and when unchecked , I want to hide the
calculatedfield out of the data area. My main difficulty is during the
uncheck..Iam using the following stmt. It doesn't seem to work. I would
appreciate if someone can tell me how I can do this.

THe statements below work well with a standard field but not with a
calculated field.

thanks
Kanan

Here is the stmt I use to drag the field to the data area:
ActiveSheet.PivotTables("PivotTable2").AddDataField
ActiveSheet.PivotTables("PivotTable2").PivotFields(Fieldname), " " +
Fieldname, xlSum

the statement to hide the calculated field from the data area is:
ActiveSheet.PivotTables("PivotTable2").PivotFields(Fieldname).Orientation =
xlHidden
 

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