ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot table calculated field in data area (https://www.excelbanter.com/excel-programming/408396-pivot-table-calculated-field-data-area.html)

Kanan

Pivot table calculated field in data area
 
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").AddDataFiel d
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




All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com