返回 XlPivotCellType 常量之一,该常量识别单元格所对应的数据透视表实体。只读。
| XlPivotCellType 可为以下 XlPivotCellType 常量之一。 | 
| xlPivotCellBlankCell 数据透视表中的一个结构空白单元格。 | 
| xlPivotCellCustomSubtotal 自定义分类汇总的行或列区域中的一个单元格。 | 
| xlPivotCellDataField 一个数据字段标志(不是“数据”按钮)。 | 
| xlPivotCellDataPivotField “数据”按钮。 | 
| xlPivotCellGrandTotal 总计行或列区域中的一个单元格。 | 
| xlPivotCellPageFieldItem 显示页字段的选定项的单元格。 | 
| xlPivotCellPivotField 字段的按钮(不是“数据”按钮)。 | 
| xlPivotCellPivotItem 不是分类汇总、总计、自定义分类汇总或空行的行或列区域中的单元格。 | 
| xlPivotCellSubtotal 分类汇总的行或列区域中的单元格。 | 
| xlPivotCellValue 数据区区域(除空行以外)中的任一单元格。 | 
expression.PivotCellType
expression 必需。该表达式返回一个 PivotCell 对象。
本示例确定数据透视表中的单元格 A5 是否是一个数据项,并通知用户。本示例假定数据透视表位于活动工作表上。如果单元格 A5 不在数据透视表中,则本示例处理运行错误。
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