ColumnItems 属性

       

返回一个 PivotItemList 集合,该集合对应于代表选定区域的列轴上的项目。

expression.ColumnItems

expression   必需。该表达式返回一个 PivotCell 对象。

示例

本示例判断单元格 B5 中的数据项是否在第一个列字段中的“Inventory”项目之下,并通知用户。本示例假定数据透视表位于活动工作表上,并且第 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