Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default How to cycle through pivot table column labels?

I need to cycle through all visible labels in pivot table columns. I tried
to use this code:

Set pt = Sheets("Table").PivotTables(1)

For Each pf In pt.ColumnFields
For Each pi In pf.PivotItems
With pi.LabelRange.Interior
.ColorIndex = 25
End With
Next pi
Next pf

If all items are visible, it works fine, but hidden items cause error. I am
trying to avoid using error handler. Anybody knows a better way?

Thanks much -
RADO


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to cycle through pivot table column labels?


FWIW I tested your code in Excel 97 and it works correctly whether the
PT columns are hidden or not.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

Reply
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
combine column labels in pivot table Joe Excel Worksheet Functions 3 October 21st 09 10:37 PM
repeat row labels in pivot table mhead Excel Worksheet Functions 2 May 4th 09 10:39 PM
pivot table vicious cycle Wanna Learn Excel Discussion (Misc queries) 2 September 8th 08 02:32 PM
Can pivot table column labels be filtered? terri.hirsch Excel Discussion (Misc queries) 1 August 14th 08 04:43 PM
How can I repeat labels in a Pivot Table? anonymous Excel Worksheet Functions 6 May 20th 05 02:26 PM


All times are GMT +1. The time now is 01:50 AM.

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

About Us

"It's about Microsoft Excel"