Upravit

Sdílet prostřednictvím


PivotCell.CustomSubtotalFunction property (Excel)

Returns the custom subtotal function field setting of a PivotCell object. Read-only XlConsolidationFunction.

Syntax

expression.CustomSubtotalFunction

expression A variable that represents a PivotCell object.

Remarks

The CustomSubtotalFunction property returns an error if the PivotCell object type is not a custom subtotal. This property applies only to non-OLAP source data.

Example

This example determines if cell C20 contains a custom subtotal function that uses a consolidation function of count, and then it notifies the user. The example assumes that a PivotTable exists on the active worksheet.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.