PivotCell.CustomSubtotalFunction 屬性 (Excel)

會傳回 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 支援與意見反應