here is my code snippet.
is my logic correct?
Code:
Private Sub Command1_Click()
Dim lngIndex As Long
For lngIndex = 1 To MSFlexGrid1.Rows - 1
With MSFlexGrid1
If .TextMatrix(lngIndex, 6) = .TextMatrix(lngIndex + 1, 6) Then
.TextMatrix(lngIndex, 1) = CLng(.TextMatrix(lngIndex, 1)) + CLng(.TextMatrix(lngIndex + 1, 1))
.TextMatrix(lngIndex, 2) = CDbl(.TextMatrix(lngIndex, 2)) + CDbl(.TextMatrix(lngIndex + 1, 2))
.TextMatrix(lngIndex, 3) = CDbl(.TextMatrix(lngIndex, 3)) + CDbl(.TextMatrix(lngIndex + 1, 3))
.TextMatrix(lngIndex, 4) = CDbl(.TextMatrix(lngIndex, 4)) + CDbl(.TextMatrix(lngIndex + 1, 4))
.TextMatrix(lngIndex, 5) = CDbl(.TextMatrix(lngIndex, 5)) + CDbl(.TextMatrix(lngIndex + 1, 5))
.TextMatrix(lngIndex, 6) = .TextMatrix(lngIndex, 6)
End If
End With
Next
End Sub