Help Center

MergeCellsproperty

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.

Windowspropertydoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

PROPERTY MergeCells () AS MergeCellsSettings
FUNCTION MergeCells (BYVAL merge AS MergeCellsSettings)

Parameters

NameDescription
mergeAn integer or constant that specifies the grouping (merging) of cells.

Description

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.

Remarks

To enable cell merging, you must follow this specific sequence:

  • Set the MergeCells property to a value other than 0 (never).
  • Set the MergeRow(index) or MergeCol(index) array properties to True for the specific rows or columns allowed to merge.
  • Ensure that adjacent cells contain the exact same text. The grid merges automatically based on content and updates immediately when cell text changes.

Example

' Enable global column-based merging grid.MergeCells = flexMergeRestrictColumns

' Allow merging specifically for the first column grid.MergeCol(0) = True

' Populate identical data to trigger the merge grid.TextMatrix(1, 0) = "Region A" grid.TextMatrix(2, 0) = "Region A"

Reference