Megosztás a következőn keresztül:


XmlMappedRange.Consolidate Method

Consolidates data from multiple ranges on multiple worksheets into an XmlMappedRange control.

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

Syntax

'Declaration
Function Consolidate ( _
    Sources As Object, _
    Function As Object, _
    TopRow As Object, _
    LeftColumn As Object, _
    CreateLinks As Object _
) As Object
Object Consolidate(
    Object Sources,
    Object Function,
    Object TopRow,
    Object LeftColumn,
    Object CreateLinks
)

Parameters

  • Sources
    Type: System.Object

    The sources of the consolidation as an array of text reference strings in R1C1-style notation. The references must include the full path of sheets to be consolidated.

  • TopRow
    Type: System.Object

    true to consolidate data based on column titles in the top row of the consolidation ranges; false to consolidate data by position. The default value is false.

  • LeftColumn
    Type: System.Object

    true to consolidate data based on row titles in the left column of the consolidation ranges; false to consolidate data by position. The default value is false.

  • CreateLinks
    Type: System.Object

    true to have the consolidation use worksheet links; false to have the consolidation copy the data. The default value is false.

Return Value

Type: System.Object

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example uses the Consolidate method to consolidate the values of cell A1 on Sheet2 and cell A1 on Sheet3 into an XmlMappedRange on Sheet1. The example consolidates the values by adding the values together. This code example assumes that Sheet1 contains an XmlMappedRange named CustomerLastNameCell.

Private Sub ConsolidateCells()
    Globals.Sheet2.Range("A1").Value2 = 1710
    Globals.Sheet3.Range("A1").Value2 = 1240

    Dim Source As String() = {"Sheet2!R1C1", "Sheet3!R1C1"}
    Globals.Sheet1.CustomerAddress1Cell.Consolidate(Source, _
        Excel.XlConsolidationFunction.xlSum, False, False, False)
End Sub
private void ConsolidateCells()
{
    Globals.Sheet2.Range["A1"].Value2 = 1710;
    Globals.Sheet3.Range["A1"].Value2 = 1240;

    string[] source = new string[] { "Sheet2!R1C1", "Sheet3!R1C1" };
    Globals.Sheet1.CustomerAddress1Cell.Consolidate(source, 
        Excel.XlConsolidationFunction.xlSum,
        false, false, false);
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace