Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Adding PivotItems

I cannot get the syntax right when trying to add PivotItems to a PivotField.
Given there are 4 possible items in a field ie L E S and (blank) I want to
ensure there are always 3 PivotItems in the resulting PTable whether there
are any values or not (I will add zeros where necessary).
1. The code below fails at the Cubefields statement with error 1004
2. Because of the fail I cannot determine whether the construct code should
be inside the With .PivotFields("L E S") procedure or outside.
Can anyone help please?

Using XL2003 and given:
ActiveWorkbook.Sheets(5).PivotTables("PivotTable1" ).PivotCache. _
CreatePivotTable TableDestination:=Sheets(5).Range("CM22"), _
TableName:="PivotTable6"

With Sheets(5).PivotTables("PivotTable6")

With .PivotFields("T")
.Caption = "Day"
''''etc etc
End With

With .PivotFields("L E S")
.Orientation = xlDataField
.Position = 1
End With

The construct then is :
If Not .PivotFields("L E S").PivotItems.Count 1 Then
'''''''''''''''''''''''''''''' goes wrong here
With ActiveSheet.PivotTables("PivotTable6").PivotFields ("[L E S]")
.CubeFields.EnableMultiplePageItems = True
End With
'''''''''''''''''''''''''''''' then something like
Do
.AddPageItem "[L E S].[xxxxx]"
Until .PivotFields("L E S").PivotItems.Count = 3

''''''''''''''''''''''''''''' then give titles to the created PivotItems
End if
End With

T.I.A.

Geoff
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
Controlling Pivotitems.visible sxhwabbiemike Excel Discussion (Misc queries) 0 January 21st 09 03:09 AM
Always keep the same 4 PivotItems visible Martin[_21_] Excel Programming 2 April 27th 05 10:17 AM
Excel 2003 Hide PivotItems Lee Excel Worksheet Functions 1 January 21st 05 08:41 PM
pivotitems in a multiuser environment Kanan Excel Programming 0 March 3rd 04 05:16 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 03:14 AM.

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

About Us

"It's about Microsoft Excel"