A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Code to Show All Pivot Table Items



 
 
Thread Tools Display Modes
  #1  
Old December 13th 03, 05:22 PM posted to microsoft.public.excel.programming
Chris
external usenet poster
 
Posts: 1
Default Code to Show All Pivot Table Items

I have a pivot table and a user form that allows the user
rearrange the pivot table by just clicking a button. The
problem I'm having is when they hide items from a field
then rearrange the table, those items remain hidden. Is
there a code I can write that checks the "(Show All)"
option on a field before my other code runs to alter the
pivot table?
Ads
  #2  
Old December 13th 03, 06:33 PM posted to microsoft.public.excel.programming
Debra Dalgleish
external usenet poster
 
Posts: 2,979
Default Code to Show All Pivot Table Items

The following code will show all items for all visible fields:

'==============================
Sub PivotShowItemAllVisible()
'For version 2000 -- show all items in 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
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
For Each pf In pt.VisibleFields
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
Next pf
Next pt
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
'=====================================

Chris wrote:
> I have a pivot table and a user form that allows the user
> rearrange the pivot table by just clicking a button. The
> problem I'm having is when they hide items from a field
> then rearrange the table, those items remain hidden. Is
> there a code I can write that checks the "(Show All)"
> option on a field before my other code runs to alter the
> pivot table?



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

 




Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pivot table - show items with no data gt Excel Discussion (Misc queries) 0 March 30th 09 07:09 PM
Show Pivot Table Items That Have No Data J Austin Excel Discussion (Misc queries) 0 October 12th 08 05:30 PM
Using Code to show all pivot items [email protected] Excel Discussion (Misc queries) 6 December 21st 06 09:50 PM
Pivot table-show all grouped items sergv Excel Discussion (Misc queries) 1 September 5th 05 07:18 PM
Pivot Table - show items with no data HJM Excel Discussion (Misc queries) 3 June 22nd 05 12:51 PM


All times are GMT +1. The time now is 03:49 AM.


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