abbeyWigan
New Member
- Joined
- Dec 7, 2007
- Messages
- 42
Does anyone know how best to navigate a pivot table sideways (i.e. on same row but from column to column) using VBA?
If I pick any pivot item in the pivot table, I can find its parent item or column heading within the same column by simply doing
However, I've been pulling my hair out trying to find a function or method that will allow me to navigate sideways, i.e. return the corresponding value (or range object) at the same level from another column.
seems to be a natural candidate but I can't get it to work. GetPivotData doesn't seem to work for me either. I'm having a really bad day on this.
My pivot table is formatted to in tabular mode with column headings and collapsible rows. All I want to do is be able to pick any sub pivot item and get its left-most parent on the same row.
If I pick any pivot item in the pivot table, I can find its parent item or column heading within the same column by simply doing
Code:
Set obj = pivotItem.Paent
However, I've been pulling my hair out trying to find a function or method that will allow me to navigate sideways, i.e. return the corresponding value (or range object) at the same level from another column.
Code:
pivotItem.DrillTo()
My pivot table is formatted to in tabular mode with column headings and collapsible rows. All I want to do is be able to pick any sub pivot item and get its left-most parent on the same row.