PivotCell.PivotCellType property (Excel)
Returns one of the XlPivotCellType constants that identifies the PivotTable entity that the cell corresponds to. Read-only.
Syntax
expression.PivotCellType
expression A variable that represents a PivotCell object.
Example
This example determines if cell A5 in the PivotTable is a data item and notifies the user. The example assumes that a PivotTable exists on the active worksheet, and cell A5 is contained in the PivotTable. If cell A5 is not in the PivotTable, the example handles the run-time error.
Sub CheckPivotCellType()
On Error GoTo Not_In_PivotTable
' Determine if cell A5 is a data item in the PivotTable.
If Application.Range("A5").PivotCell.PivotCellType = xlPivotCellValue Then
MsgBox "The cell at A5 is a data item."
Else
MsgBox "The cell at A5 is not a data item."
End If
Exit Sub
Not_In_PivotTable:
MsgBox "The chosen cell is not in a PivotTable."
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.