NamedRange::Consolidate Method (Object^, Object^, Object^, Object^, Object^)
Consolidates data from multiple ranges on multiple worksheets into the NamedRange control.
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
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.
- Function
-
Type:
System::Object^
Can be one of the following XlConsolidationFunction constants:
- 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^For information on optional parameters, see Optional Parameters in Office Solutions.
The following code example sets the range of cells from B1 through D10 to random numbers and then uses the Consolidate method to consolidate this range into a NamedRange control.
This example is for a document-level customization.