PivotCell Members
Use the PivotCell object to get pivot table information from a Range object. Use the Range object’s PivotCell property to get a reference to this object. The PivotCell object has the following members:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Use PivotCell when working with user selections to find information about the selected cells. The following code displays pivot table information about the currently selected range:
Sub GetPivotCell( )
Dim pc As PivotCell
On Error Resume Next
' Get the pivot cell
Set pc = Selection.PivotCell
Debug.Print pc.PivotCellType, _
pc.PivotField.name, pc.PivotTable.name
If Err Then Debug.Print "Selection is not in a pivot range."
On Error GoTo 0
End SubBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access