pjfatboy
08-01-2005, 07:27 PM
I have a grid on my form that I merge Col(0) in groups of 3 rows. So every 3 rows will be merged. My question is, I thought cells would only merge if the data is the same in the cells that is suppose to merge. What is happening is if no data is being added to some of the cells all of the cells past that point merges together, even if no data is being added to those cells. Here is my code and a picture of what is happening.
If Form2.SCGrid.TextMatrix(2, 1) > "" Then
For j = 2 To 4
.MergeCells = flexMergeFree
.TextMatrix(j, 0) = Form2.SCGrid.TextMatrix(2, 1)
.MergeCol(0) = True
If Form2.SCGrid.TextMatrix(2, 2) = 3 Then
.TextMatrix(j, 2) = Form2.SCGrid.TextMatrix(2, 3)
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.8 / 5) * 5
.TextMatrix(3, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.9 / 5) * 5
.TextMatrix(4, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(3, 1) = "2"
.TextMatrix(4, 1) = "3"
.TextMatrix(2, 4) = "Warmup Set"
.TextMatrix(3, 4) = "Warmup Set"
.TextMatrix(4, 4) = "Power Set"
ElseIf Form2.SCGrid.TextMatrix(2, 2) = 2 Then
For i = 2 To 3
.TextMatrix(i, 2) = Form2.SCGrid.TextMatrix(2, 3)
Next i
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.9 / 5) * 5
.TextMatrix(3, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(3, 1) = "2"
.TextMatrix(2, 4) = "Warmup Set"
.TextMatrix(3, 4) = "Power Set"
ElseIf Form2.SCGrid.TextMatrix(2, 2) = 1 Then
.TextMatrix(2, 2) = Form2.SCGrid.TextMatrix(2, 3)
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(2, 4) = "Power Set"
End If
Next j
End If
If Form2.SCGrid.TextMatrix(9, 1) > "" Then
For j = 5 To 7
.MergeCells = flexMergeFree
.TextMatrix(j, 0) = Form2.SCGrid.TextMatrix(9, 1)
.MergeCol(0) = True
If Form2.SCGrid.TextMatrix(9, 2) = 3 Then
.TextMatrix(j, 2) = Form2.SCGrid.TextMatrix(9, 3)
.TextMatrix(5, 3) = Int(Form2.SCGrid.TextMatrix(9, 4) * 0.8 / 5) * 5
.TextMatrix(6, 3) = Int(Form2.SCGrid.TextMatrix(9, 4) * 0.9 / 5) * 5
.TextMatrix(7, 3) = Int(Form2.SCGrid.TextMatrix(9, 4))
.TextMatrix(5, 1) = "1"
etc.
If Form2.SCGrid.TextMatrix(2, 1) > "" Then
For j = 2 To 4
.MergeCells = flexMergeFree
.TextMatrix(j, 0) = Form2.SCGrid.TextMatrix(2, 1)
.MergeCol(0) = True
If Form2.SCGrid.TextMatrix(2, 2) = 3 Then
.TextMatrix(j, 2) = Form2.SCGrid.TextMatrix(2, 3)
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.8 / 5) * 5
.TextMatrix(3, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.9 / 5) * 5
.TextMatrix(4, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(3, 1) = "2"
.TextMatrix(4, 1) = "3"
.TextMatrix(2, 4) = "Warmup Set"
.TextMatrix(3, 4) = "Warmup Set"
.TextMatrix(4, 4) = "Power Set"
ElseIf Form2.SCGrid.TextMatrix(2, 2) = 2 Then
For i = 2 To 3
.TextMatrix(i, 2) = Form2.SCGrid.TextMatrix(2, 3)
Next i
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.9 / 5) * 5
.TextMatrix(3, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(3, 1) = "2"
.TextMatrix(2, 4) = "Warmup Set"
.TextMatrix(3, 4) = "Power Set"
ElseIf Form2.SCGrid.TextMatrix(2, 2) = 1 Then
.TextMatrix(2, 2) = Form2.SCGrid.TextMatrix(2, 3)
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(2, 4) = "Power Set"
End If
Next j
End If
If Form2.SCGrid.TextMatrix(9, 1) > "" Then
For j = 5 To 7
.MergeCells = flexMergeFree
.TextMatrix(j, 0) = Form2.SCGrid.TextMatrix(9, 1)
.MergeCol(0) = True
If Form2.SCGrid.TextMatrix(9, 2) = 3 Then
.TextMatrix(j, 2) = Form2.SCGrid.TextMatrix(9, 3)
.TextMatrix(5, 3) = Int(Form2.SCGrid.TextMatrix(9, 4) * 0.8 / 5) * 5
.TextMatrix(6, 3) = Int(Form2.SCGrid.TextMatrix(9, 4) * 0.9 / 5) * 5
.TextMatrix(7, 3) = Int(Form2.SCGrid.TextMatrix(9, 4))
.TextMatrix(5, 1) = "1"
etc.