Export (0) Print
Expand All
Expand Minimize

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)

public XlConsolidationFunction ConsolidationFunction { get; }

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 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.");
}

Show:
© 2014 Microsoft