Syntax

expression.PivotCellType

expression A variable that represents a PivotCell object.

Remarks

XlPivotCellType can be one of these XlPivotCellType constants.
xlPivotCellBlankCell A structural blank cell in the PivotTable.
xlPivotCellCustomSubtotal A cell in the row or column area that is a custom subtotal.
xlPivotCellDataField A data field label (not the Data button).
xlPivotCellDataPivotField The Data button.
xlPivotCellGrandTotal A cell in a row or column area which is a grand total.
xlPivotCellPageFieldItem The cell that shows the selected item of a Page field.
xlPivotCellPivotField The button for a field (not the Data button).
xlPivotCellPivotItem A cell in the row or column area which is not a subtotal, grand total, custom subtotal, or blank line.
xlPivotCellSubtotal A cell in the row or column area which is a subtotal.
xlPivotCellValue Any cell in the data area (except a blank row).

Example

This example determines if cell A5 in the PivotTable is a data item and notifies the user. The example assumes 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.

Visual Basic for Applications
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
pivot cell type pivotcell pivotcelltype pivotcelltype property

See also: