Returns or sets a value that determines whether cells with the same contents should be grouped in a single cell spanning multiple rows or columns.
Syntax
object.MergeCells [=value]
The MergeCells property syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
value | An integer or constant that specifies the grouping (merging) of cells, as specified in Settings. |
Settings
The settings for value are:
Constant | Value | Description |
flexMergeNever | 0 | Never. The cells containing identical content are not grouped. This is the default. |
flexMergeFree | 1 | Free. Cells with identical content always merge. |
flexMergeRestrictRows | 2 | Restrict Rows. Only adjacent cells (to the left of the current cell) within the row containing identical content merge. |
flexMergeRestrictColumns | 3 | Restrict Columns. Only adjacent cells (to the top of the current cell) within the column containing identical content merge. |
flexMergeRestrictBoth | 4 | Restrict Both. Only adjacent cells within the row (to the left) or column (to the top) containing identical content merge. |
Remarks
The ability to merge cells enables you to present data in a clear, concise manner. You can use cell merging in conjunction with the sorting and column order functions of the MSHFlexGrid.
To use the cell merging capabilities of the MSHFlexGrid:
When using the cell merging capabilities, the MSHFlexGrid merges cells with identical content. The merging is automatically updated whenever the cell content changes.
When MergeCells is set to a value other than 0 (Never), selection highlighting is automatically turned off. This is done to speed up repainting, and because selection of ranges containing merged cells may lead to unexpected results.