Udostępnij za pośrednictwem


Worksheet.ConsolidationFunction Property (2007 System)

Gets the function code used for the current consolidation.

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

Syntax

'Declaration
Public ReadOnly Property ConsolidationFunction As XlConsolidationFunction
'Usage
Dim instance As Worksheet 
Dim value As XlConsolidationFunction 

value = instance.ConsolidationFunction
public XlConsolidationFunction ConsolidationFunction { get; }
public:
property XlConsolidationFunction ConsolidationFunction {
    XlConsolidationFunction get ();
}
public function get ConsolidationFunction () : XlConsolidationFunction

Property Value

Type: 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

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace