Excel) (PivotCell.CustomSubtotalFunction 屬性

會傳回 PivotCell 物件的自訂小計函數欄位設定。 唯讀 XlConsolidationFunction。

語法

運算式。CustomSubtotalFunction

運算式 代表 PivotCell 物件的變數。

註解

如果 PivotCell 物件類型不是自訂小計,CustomSubtotalFunction 屬性會傳回錯誤。 此屬性僅適用於非 OLAP 資料來源。

範例

此範例會判斷儲存格 C20 是否包含使用 COUNT 合併函數的自訂小計函數,然後通知使用者。 假設使用中工作表上有一個樞紐分析表。

Sub UseCustomSubtotalFunction() 
 
 On Error GoTo Not_A_Function 
 
 ' Determine if custom subtotal function is a count function. 
 If Application.Range("C20").PivotCell.CustomSubtotalFunction = xlCount Then 
 MsgBox "The custom subtotal function is a Count." 
 Else 
 MsgBox "The custom subtotal function is not a Count." 
 End If 
 Exit Sub 
 
Not_A_Function: 
 MsgBox "The selected cell is not a custom subtotal function." 
 
End Sub

支援和意見反應

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