Dim i As Long
With grd
.Cols = 4
.Rows = 3
.FixedRows = 2
.FixedCols = 0
.MergeCells = flexMergeFree
.MergeRow(0) = True
.MergeRow(1) = True
.TextMatrix(0, 0) = "A"
.TextMatrix(0, 1) = "A"
.TextMatrix(0, 2) = "B"
.TextMatrix(0, 3) = "B"
.TextMatrix(1, 0) = "A1"
.TextMatrix(1, 1) = "A2"
.TextMatrix(1, 2) = "B1"
.TextMatrix(1, 3) = "B2"
For i = 0 To .Cols - 1
.ColAlignmentFixed(i) = 4
Next i
End With
With grd
.Cols = 4
.Rows = 3
.FixedRows = 2
.FixedCols = 0
.MergeCells = flexMergeFree
.MergeRow(0) = True
.MergeRow(1) = True
.TextMatrix(0, 0) = "A"
.TextMatrix(0, 1) = "A"
.TextMatrix(0, 2) = "B"
.TextMatrix(0, 3) = "B"
.TextMatrix(1, 0) = "A1"
.TextMatrix(1, 1) = "A2"
.TextMatrix(1, 2) = "B1"
.TextMatrix(1, 3) = "B2"
For i = 0 To .Cols - 1
.ColAlignmentFixed(i) = 4
Next i
End With
grd.MergeRow(5) = True