Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mxc mxc is offline
external usenet poster
 
Posts: 1
Default ChildItems and ParentItem of PivotItem object dont seem to work

Hi there,

I need to retrive data from a pivot table that is not from an OLAP source. I
need to get the data for a item and then also display that data for the
parent of that item. Basically they want to see sales for a particular
product and then the sales of that product group. There are hundreds of
products so I need to be able to lookup its parent from the pivot table. Once
I have the parent I can retrieve data using getPivotData.

However I just get the message ""Unable to get the ParentItem property of
the PivotItem"

It says something similar if I try to get the ChildItems collection.

Any help is appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default ChildItems and ParentItem of PivotItem object dont seem to work

ParentItem and ChildItem are for grouped items. The following code
should work for adjacent column fields.

'==============================
Sub GetOuterFieldItem()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim rngPG As Range

Set pt = ActiveSheet.PivotTables(1)
Set pf = pt.PivotFields("Product")
Set pi = pf.PivotItems("ProductA")
Set rngPG = Range(pi.LabelRange.Address).Offset(0, -1)

Debug.Print rngPG.PivotItem.Name

End Sub
'========================

mxc wrote:
Hi there,

I need to retrive data from a pivot table that is not from an OLAP source. I
need to get the data for a item and then also display that data for the
parent of that item. Basically they want to see sales for a particular
product and then the sales of that product group. There are hundreds of
products so I need to be able to lookup its parent from the pivot table. Once
I have the parent I can retrieve data using getPivotData.

However I just get the message ""Unable to get the ParentItem property of
the PivotItem"

It says something similar if I try to get the ChildItems collection.

Any help is appreciated.



--
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
flash object dont work in my excel work sheet Nitn Excel Discussion (Misc queries) 0 July 4th 09 08:00 AM
New Buttons dont work after I put them in the toolbar Dave in Nashville New Users to Excel 2 June 22nd 06 05:25 PM
Formulas dont work comotoman Excel Discussion (Misc queries) 4 October 3rd 05 06:48 PM
PivotTable: ChildItems and ParentItem don't work Seb Thirlway[_2_] Excel Programming 0 November 25th 04 01:17 PM
macros dont work meagain Excel Programming 8 June 3rd 04 08:58 PM


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