返回与列轴上表示选定范围的项目对应的 PivotItemList 集合。
语法
表达式。ColumnItems
表达式 表示 PivotCell 对象的变量。
示例
此示例确定单元格 B5 中的数据项是否位于第一列字段的“清单”项下,并通知用户。 本示例假定数据透视表位于活动工作表上,并且第 B 列包含数据透视表的列字段。
Sub CheckColumnItems()
' Determine if there is a match between the item and column field.
If Application.Range("B5").PivotCell.ColumnItems.Item(1) = "Inventory" Then
MsgBox "Item in B5 is a member of the 'Inventory' column field."
Else
MsgBox "Item in B5 is not a member of the 'Inventory' column field."
End If
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。