Most valuable professional
  • Hot Topics

Excel Code for Pivot Charts

I have a code for a user form that works well for the most part. It is a long code. I was wondering if there is any way to turn off a current Pivot Table Field that is selected, the only way I could figure out how to do it was turn each field off at the begining of the macro, this is the code I currently have to start my macro. I could run in to problems if someone where to try to change the pivot field manually and excel puts the new category in the row lable instead of values or if it was in values and not as a sum but as "count." I would need a code 3 times this long to cover all of the basis. On Error Resume Next ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Haz Intensity"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Non-Haz Intensity"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Ink Intensity"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Water Intensity"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Gas Intensity"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Electric Intensity") _ .Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Haz (lbs)"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Non-Haz (Lbs)"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Ink (Gallons)"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Water (Gallons)"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Gas (Therms)"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Electric (kWh)"). _ Orientation = xlHidden ActiveSheet.PivotTables("PivotTable7").PivotFields("Sum of Output (Packages)"). _ Orientation = xlHidden

This question generated 28 answers. To proceed to the answers, click here.

This thread is current as of June 10, 2014.

For more resources for Microsoft Excel:

This article includes the following tags:

  • Excel
  • Microsoft Excel