Merge Method

Applies To

Range object, Scenarios collection object, Styles collection object.

Description

Syntax 1: Merges the scenarios from another sheet into the Scenarios collection.

Syntax 2: Merges the styles from another workbook into the Styles collection.

Syntax 3: Creates a merged cell from the specified Range object.

Syntax 1

expression.Merge(Source)

Syntax 2

expression.Merge(Workbook)

Syntax 3

expression.Merge(Across)

expression Required. An expression that returns a Scenarios object (Syntax 1), Styles object (Syntax 2), or Range object (Syntax 3).

Source Required Variant. The name of the sheet that contains scenarios to be merged, or a Worksheet object that represents that sheet.

Workbook Required Variant. A Workbook object that represents the workbook containing styles to be merged.

Across Optional Variant. True to merge cells in each row in the specified range as separate merged cells. The default value is False.

Remarks

The value of a merged range is the value specified for the cell in the upper-left corner of the merged range.

See Also

MergeArea property, MergeCells property, UnMerge method.

Example

This example merges the styles from the workbook Template.xls into the active workbook.

ActiveWorkbook.Styles.Merge Workbook:=Workbooks("Template.xls")