WorksheetBase.ConsolidationFunction Property

Definition

Gets the function code used for the current consolidation.

public:
 property Microsoft::Office::Interop::Excel::XlConsolidationFunction ConsolidationFunction { Microsoft::Office::Interop::Excel::XlConsolidationFunction get(); };
public Microsoft.Office.Interop.Excel.XlConsolidationFunction ConsolidationFunction { get; }
member this.ConsolidationFunction : Microsoft.Office.Interop.Excel.XlConsolidationFunction
Public ReadOnly Property ConsolidationFunction As XlConsolidationFunction

Property Value

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

Applies to