Getting the value of the selected cell

D

Dan Ricker

VBScript Sample Code for OWC10 (Warning Air Code)

1) Get Value of selected "PivotMember" (Row/Column Member)

Set objPMs = PivotTable.Selection
Set objPM = objPMs(0)
Msgbox objPM.Name & vbCrLf & objPM.UniqueName

2) Get Value of Selected Aggregate

Set objPAggs = PivotTable.Selection
Set objPAgg = objPAggs(0).Aggregates
Msgbox objPAgg.Value

3) Get Value of Selected PivotDetailCell

Set objPDetailRange = PivotTable.Selection
Set objPDetailCell = objPDetailRange.TopLeft
Msgbox objPDetailCell.Value

***************************
There is also the PivotTable.ActiveObject property which
will help deal with multiple RowMember, ColumnMember,
Aggregates and DetailCell selections.

Thx
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top