I have a PowerPivot table and I'm using VBA to try to return the caption on certain RowItems based on the selected cell.
So if my selected cell is in the values area of my PT, I use this
Which gives me the fully qualified value with Table and Column Name such as
[Sales].[Customer].[CustomerName]
However, all I really want is CustomerName.
I know I could do different things with replace or substitute to get it... but I just feel there must be same way...?
I tried
But this returns blank.
Ultimately, I am trying to return the values in the RowFields of the Pivot based on the selected PivotCell, so if there is some other, better, way, I'm not tied to using the code above.
So if my selected cell is in the values area of my PT, I use this
Code:
ActiveCell.PivotCell.RowItems(1).Name
Which gives me the fully qualified value with Table and Column Name such as
[Sales].[Customer].[CustomerName]
However, all I really want is CustomerName.
I know I could do different things with replace or substitute to get it... but I just feel there must be same way...?
I tried
Code:
ActiveCell.PivotCell.RowItems(1).Caption
But this returns blank.
Ultimately, I am trying to return the values in the RowFields of the Pivot based on the selected PivotCell, so if there is some other, better, way, I'm not tied to using the code above.