PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Charting Pivot Table Field Choices

Reply

Pivot Table Field Choices

 
Thread Tools Rate Thread
Old 02-07-2003, 03:12 PM   #1
Sue
Guest
 
Posts: n/a
Default Pivot Table Field Choices


Is there a global way to uncheck ALL of the boxes in a
pivot table field button pull down? I see the way to do
this if you have 2 levels but all of mine are single
level, and I have a hundred plus. Thanks in advance if
anyone has a trick!
  Reply With Quote
Old 03-07-2003, 08:29 PM   #2
Debra Dalgleish
Guest
 
Posts: n/a
Default Re: Pivot Table Field Choices

You can do this with a macro. The first macro hides all items except the
last one, and the second one shows all items. Replace "Rep" with the
name of your field.

Sub PivotHideItemsField()
'For version 2000 -- hide all items in specific field
'sort is set to Manual to prevent errors, e.g.
'unable to set Visible Property of PivotItem class
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables(1)
Set pf = pt.PivotFields("Rep")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
With pt.PivotFields("Rep")
pf.AutoSort xlManual, pf.SourceName
For Each pi In pf.PivotItems
pi.Visible = False
Next pi
pf.AutoSort xlAscending, pf.SourceName
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Sub PivotShowItemsField()
'For version 2000 -- show all items in specific field
'sort is set to Manual to prevent errors, e.g.
'unable to set Visible Property of PivotItem class
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables(1)
Set pf = pt.PivotFields("Rep")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
With pt.PivotFields("Rep")
pf.AutoSort xlManual, pf.SourceName
For Each pi In pf.PivotItems
If pi.Visible <> True Then
pi.Visible = True
End If
Next pi
pf.AutoSort xlAscending, pf.SourceName
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Sue wrote:
> Is there a global way to uncheck ALL of the boxes in a
> pivot table field button pull down? I see the way to do
> this if you have 2 levels but all of mine are single
> level, and I have a hundred plus. Thanks in advance if
> anyone has a trick!



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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off