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: 2
Default How to cycle through displayed PivotItems instead of the VisibleItemscollection

Hi,

I've run into a bit of a pickle with a VBA script.

The script sets formatting on PivotItems by cycling through the
VisibleItems collection. This works fine until I add a page field.
I've figured out that the Visible property of the PivotItem stays True
even though the item may be hidden by the selection on the page field.
The collection is therefore not that useful to me since it will cause
errors with any calls to get a range for any PivotItem hidden from
view by the page field. How can I get around this?

Below is an excerpt of the script in question:
==================================================
01 Dim pvtItems As PivotItems, pvtItem As PivotItem
02 Set pvtItems = pvtTable.PivotFields(myRow).VisibleItems
03 For Each pvtItem In pvtItems
04 pvtItem.LabelRange.Select
05
06 With Selection
07 .Borders.LineStyle = xlNone
08 .Borders(xlEdgeTop).LineStyle = xlContinuous
09 .Borders(xlEdgeTop).Weight = xlHairline
10 .Borders(xlEdgeTop).ColorIndex = xlAutomatic
11 .Borders(xlEdgeBottom).LineStyle = xlContinuous
12 .Borders(xlEdgeBottom).Weight = xlHairline
13 .Borders(xlEdgeBottom).ColorIndex = xlAutomatic
14 End With
15 Next pvtItem
==================================================

The above script will fail on line 04 as soon as it hits an PivotItem
which is hidden from view by any other selections made in the pivot
table (e.g. on the page field).

Your help is greatly appreciated.

- Thomas

 
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
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? Charles A. Wilson Charts and Charting in Excel 1 December 17th 09 03:03 AM
Missing PivotItems [email protected][_2_] Excel Programming 3 August 28th 08 10:09 PM
PivotItems Bug?! WhytheQ Excel Programming 2 November 29th 06 04:31 PM
How do I keep result from 1 iteration cycle to use in next cycle? sgl8akm Excel Discussion (Misc queries) 0 July 27th 06 08:28 PM
Add PivotItems to PivotTable / Enabling - Disabling PivotItems Ole[_3_] Excel Programming 1 July 8th 03 03:24 PM


All times are GMT +1. The time now is 11:00 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"