Range.Consolidate Method

Consolidates data from multiple ranges on multiple worksheets into a single range on a single worksheet.

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

Syntax

'Declaration
Function Consolidate ( _
    Sources As Object, _
    Function As Object, _
    TopRow As Object, _
    LeftColumn As Object, _
    CreateLinks As Object _
) As Object
'Usage
Dim instance As Range
Dim Sources As Object
Dim Function As Object
Dim TopRow As Object
Dim LeftColumn As Object
Dim CreateLinks As Object
Dim returnValue As Object

returnValue = instance.Consolidate(Sources, _
    Function, TopRow, LeftColumn, CreateLinks)
Object Consolidate(
    Object Sources,
    Object Function,
    Object TopRow,
    Object LeftColumn,
    Object CreateLinks
)

Parameters

  • Sources
    Type: System.Object

    Optional 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.

  • Function
    Type: System.Object

    Optional XlConsolidationFunction. Can be one of the following XlConsilidationFunction constants:

    • xlAveragedefault

    • xlCount

    • xlCountNums

    • xlMax

    • xlMin

    • xlProduct

    • xlStDev

    • xlStDevP

    • xlSum

    • xlVar

    • xlVarP

  • TopRow
    Type: System.Object

    Optional 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

    Optional 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

    Optional 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

See Also

Reference

Range Interface

Range Members

Microsoft.Office.Interop.Excel Namespace