Export (0) Print
Expand All

Range.Consolidate Method

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

Syntax

expression.Consolidate(Sources, Function, TopRow, LeftColumn, CreateLinks)

expression   A variable that represents a Range object.

Parameters

NameRequired/OptionalData TypeDescription
SourcesOptionalVariantThe 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.
FunctionOptionalVariantOne of the constants of XlConsolidationFunction which specifies the type of consolidation.
TopRowOptionalVariantTrue 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.
LeftColumnOptionalVariantTrue 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.
CreateLinksOptionalVariantTrue to have the consolidation use worksheet links. False to have the consolidation copy the data. The default value is False.

Return Value
Variant

Example

This example consolidates data from Sheet2 and Sheet3 onto Sheet1, using the SUM function.

Visual Basic for Applications
Worksheets("Sheet1").Range("A1").Consolidate _
    Sources:=Array("Sheet2!R1C1:R37C6", "Sheet3!R1C1:R37C6"), _
    Function:=xlSum



Community Additions

ADD
Show:
© 2014 Microsoft