Excel) (Range.LocationInTable 屬性

傳回常數,描述包含指定範圍左上角的資料 透視表 部分。 可以是下列其中一個 XlLocationInTable 常數。 唯讀的 Long

語法

運算式LocationInTable

expression 代表 Range 物件的變數。

範例

本範例會顯示一個訊息方塊,說明樞紐分析表中作用儲存格所在的位置。

Worksheets("Sheet1").Activate 
Select Case ActiveCell.LocationInTable 
Case Is = xlRowHeader 
 MsgBox "Active cell is part of a row header" 
Case Is = xlColumnHeader 
 MsgBox "Active cell is part of a column header" 
Case Is = xlPageHeader 
 MsgBox "Active cell is part of a page header" 
Case Is = xlDataHeader 
 MsgBox "Active cell is part of a data header" 
Case Is = xlRowItem 
 MsgBox "Active cell is part of a row item" 
Case Is = xlColumnItem 
 MsgBox "Active cell is part of a column item" 
Case Is = xlPageItem 
 MsgBox "Active cell is part of a page item" 
Case Is = xlDataItem 
 MsgBox "Active cell is part of a data item" 
Case Is = xlTableBody 
 MsgBox "Active cell is part of the table body" 
End Select

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應