VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Methods > GetMergedRange Method |
Returns the range of merged cells that includes a given cell.
[form!]VSFlexGrid.GetMergedRange Row As Long, Col As Long, R1 As Long, C1 As Long, R2 As Long, C2 As Long
The VSFlexGrid control can merge cells based on their contents. This method allows you to determine whether a cell is merged with its neighboring cells.
For example, the following code changes the contents of a merged cell preserving the merged range:
' create a merged range
fg.MergeCells = flexMergeFree
fg.MergeRow(1) = True
fg.Cell(flexcpText, 1, 1, 1, 4) = "Merged Range"
' this changes only cell 1, 1
fg.Cell(flexcpText, 1, 1) = "Merged Range Has Changed"
' this changes the whole merged range
Dim r1&, c1&, r2&, c2&
fg.GetMergedRange 1, 2, r1, r2, c1, c2
fg.Cell(flexcpText, 1, 1, 1, 4) = "Merged Range Has Changed"
For more details on cell merging, see theMergeCells property.