WorksheetBase.ConsolidationFunction Property

Gets the function code used for the current consolidation.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property ConsolidationFunction As XlConsolidationFunction
    Get
public XlConsolidationFunction ConsolidationFunction { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.XlConsolidationFunction
One of the XlConsolidationFunction values.

Examples

The following code example uses the ConsolidationFunction property to determine which function is used by the worksheet for consolidation.

This example is for a document-level customization.

Private Sub ShowConsolidationFunction()
    Dim simpleName As String

    Select Case Me.ConsolidationFunction
        Case Excel.XlConsolidationFunction.xlSum
            simpleName = "Sum()"
        Case Excel.XlConsolidationFunction.xlMax
            simpleName = "Max()"
        Case Excel.XlConsolidationFunction.xlProduct
            simpleName = "Product()"
        Case Else
            simpleName = "Other"
    End Select
    MsgBox("This worksheet uses " & simpleName & _
        " for the consolidation function.")
End Sub
private void ShowConsolidationFunction()
{
    string simpleName;

    switch (this.ConsolidationFunction)
    {
        case Excel.XlConsolidationFunction.xlSum:
            simpleName = "Sum()";
            break;

        case Excel.XlConsolidationFunction.xlMax:
            simpleName = "Max()";
            break;

        case Excel.XlConsolidationFunction.xlProduct:
            simpleName = "Product()";
            break;

        default:
            simpleName = "Other";
            break;
    }
    MessageBox.Show("This worksheet uses " + simpleName +
        " for the consolidation function.");
}

.NET Framework Security

See Also

Reference

WorksheetBase Class

Microsoft.Office.Tools.Excel Namespace