PivotCell.PivotCellType 属性 (Excel)
返回一个 XlPivotCellType 常量,该常量标识单元格所对应的数据透视表实体。 此为只读属性。
语法
表达式。PivotCellType
表达 一个代表 PivotCell 对象的变量。
示例
本示例确定数据透视表中的单元格 A5 是否是一个数据项,并通知用户。 该示例假定活动工作表上存在数据透视表,单元格 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
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈