LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default macro to turn pivot table field on and off

I have four pivot views, D Rank, S Rank, B Rank and O Rank. I know
how to add an items as illustrated below below, however removing it
errors when it's actually not there...how do I avoid this is my
question?

ActiveCell.FormulaR1C1 = "Data Completeness Rank"


' if the Pivot field is not showing I error out just below
ActiveSheet.PivotTables("PivotTable1").PivotFields ("S
Rank").Orientation _
= xlHidden
ActiveSheet.PivotTables("PivotTable1").PivotFields ("B Rank"). _
Orientation = xlHidden
ActiveSheet.PivotTables("PivotTable1").PivotFields ("O Rank"). _
Orientation = xlHidden


ActiveSheet.PivotTables("PivotTable1").AddDataFiel d
ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("DC Rank"), "Sum of DC Rank",
xlSum
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table in a macro only bringing in One Field Beverly76 Excel Programming 1 September 30th 08 10:52 PM
Pivot Table field macro [email protected] Excel Worksheet Functions 1 June 22nd 08 12:21 AM
Code for a Macro that allows a Pivot table to be repeatedly run (fora dynamic rows in a table, but static field names) Mike C[_5_] Excel Programming 1 February 11th 08 04:30 AM
How to turn off dragging for a Pivot Table field sebastienm Excel Programming 0 September 20th 04 05:55 PM
How to turn off dragging for a Pivot Table field Prabhakar Excel Programming 0 September 20th 04 03:03 PM


All times are GMT +1. The time now is 10:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"