LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Pivot Table Issue...

If the field is set for automatic sort, you'll get an error. You can add
code to set the sort to manual, e.g.:

With myPiv.PivotFields("Year to View")
.AutoSort xlManual, .Name
End With

For Each myPI In myPiv.PivotFields("Year to View").PivotItems
'On Error Resume Next
myPI.Visible = True
Next

Trevor Williams wrote:
Dear All

Can anyone shed any light on why my pivot table won't show the PivotItems
using the following code?

Sub TestPiv()
Dim myPiv As PivotTable, myPI As PivotItem
Set myPiv = ActiveSheet.PivotTables("PivotTable1")
For Each myPI In myPiv.PivotFields("Year to View").PivotItems
'On Error Resume Next
myPI.Visible = True
Next
End Sub

If I record a macro to 'show all' I get the following code which, when run
again, doesn't work either. Very odd.

Sub Macro4()'
' Macro4 Macro
' Macro recorded 06/05/2008 by .
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Year to View")
.PivotItems("2007").Visible = True
.PivotItems("2008").Visible = True
.PivotItems("2010").Visible = True
.PivotItems("2011").Visible = True
.PivotItems("2012").Visible = True
.PivotItems("2013").Visible = True
.PivotItems("2014").Visible = True
End With
End Sub

Any help appreciated

Trevor Williams



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

 
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
One pivot table cannot overlap another pivot issue. Avi Excel Discussion (Misc queries) 1 October 5th 09 02:29 PM
Pivot table sum issue Phil Smith Excel Discussion (Misc queries) 5 May 15th 08 03:18 AM
Pivot Table Issue Titanium Excel Worksheet Functions 2 June 17th 07 08:51 PM
A Pivot table issue Yakimoto Excel Programming 5 December 9th 03 02:19 PM
Pivot Table issue Pedro Excel Programming 4 August 29th 03 05:07 PM


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