全部显示

CustomSubtotalFunction 属性

       

返回 PivotCell 对象的自定义分类汇总函数字段的设置。XlConsolidationFunction 类型,只读。

expression.CustomSubtotalFunction

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

说明

如果 PivotCell 对象类型不是自定义分类汇总,那么 CustomSubtotalFunction 属性将返回一个错误。该属性只应用于非 OLAP 源数据

示例

本示例确定单元格 C20 是否包含使用计数合并函数的自定义分类汇总函数,并通知用户。本示例假定数据透视表位于活动的工作表上。

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