Hello
I have a msflexgrid control which comprises 6 columns and 8 rows (I'm using
Visual Basic 6 ).
In row 4, I need to merge columns 2,3,4,5
In row 6, I need to merge columns 3 and 4.
I've tried a number of ways to do the above, but I still can't get it work.
Any suggestions would be much appreciated
Thanks
Darryl Kirtland
Rick Rothstein (MVP - VB) - 28 Sep 2006 04:35 GMT
> I have a msflexgrid control which comprises 6 columns and 8 rows (I'm
> using Visual Basic 6 ).
[quoted text clipped - 7 lines]
>
> Any suggestions would be much appreciated
Put the data into the grid first, then do the merge stuff. Here is some
sample code...
Dim X As Long
Dim Y As Long
With MSFlexGrid1
' Put something in every cell
For X = 0 To .Rows - 1
For Y = 0 To .Cols - 1
.TextMatrix(X, Y) = "Row: " & X & ", Col: " & Y
Next
Next
' Go back and set the same values in the cells to be merged
.Row = 4
For Y = 2 To 5
.TextMatrix(.Row, Y) = "Same Value 1"
Next
.Row = 6
.TextMatrix(.Row, 2) = "Same Value 2"
.TextMatrix(.Row, 3) = "Same Value 2"
' Now merge the like cells per given row
.MergeCells = flexMergeFree
.MergeRow(4) = True
.MergeRow(6) = True
End With
Rick