Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Delete/Hide PivotTable PageFields "(ALL)" Option

Hi All,

I am using Excel 2000. I wish to get ride of that "(ALL)" option in
Excel PivotTable PageFields by delete/hide it using VBA.

The surprising thing is: This "(ALL)" not belong to PivotItem of
PageFields or PivotFields. It seems can't be accessed UNLESS it is
displayed as

PageFields.VisibleItem(1) (by default)

When I try

PageFields.PivotItem("(ALL)").Visible = False

I always get the same error message:

"Object doesn't support this property or method"

Thanks in advance.

Charles
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Delete/Hide PivotTable PageFields "(ALL)" Option

As answered in microsoft.public.excel --

You could use the Worksheet_Calculate event to switch the selection to
the first item in the page field list. Place the following code on the
worksheet module:

'==========================
Private Sub Worksheet_Calculate()
'if (All) is selected from a page field
'the first item is selected instead
Dim pt As PivotTable
Dim pf As PivotField

Set pt = ActiveSheet.PivotTables(1)
For Each pf In pt.PageFields
If pf.CurrentPage = "(All)" Then
pf.CurrentPage = pf.PivotItems(1).Name
End If
Next pf
Application.EnableEvents = True
End Sub
'===============================

Charles wrote:
Hi All,

I am using Excel 2000. I wish to get ride of that "(ALL)" option in
Excel PivotTable PageFields by delete/hide it using VBA.

The surprising thing is: This "(ALL)" not belong to PivotItem of
PageFields or PivotFields. It seems can't be accessed UNLESS it is
displayed as

PageFields.VisibleItem(1) (by default)

When I try

PageFields.PivotItem("(ALL)").Visible = False

I always get the same error message:

"Object doesn't support this property or method"

Thanks in advance.

Charles



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

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
2007 Need macro to auto set option buttons all to "Yes" or "No" Paula Excel Worksheet Functions 1 October 20th 09 08:07 PM
Why is the "zoom" option grayed out in "print preview?" sschreiber Excel Discussion (Misc queries) 0 November 29th 07 04:42 PM
pictures to work with "data" "sort" option arad Excel Discussion (Misc queries) 1 April 18th 06 09:15 PM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM
Make "Worksheet Menu Bar" invisible or Delete/hide it's buttons Bob Phillips[_5_] Excel Programming 0 August 11th 03 01:05 PM


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

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"