共用方式為


Excel) (PivotCell.ColumnItems 屬性

傳回 PivotItemList 集合,該集合對應至資料行軸上代表所選範圍之專案。

語法

表達。資料行項目

代表 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 支援與意見反應