让VB控件MSHFlexGrid显示合计栏
Sub bt()
Dim tmp_a As Double
Dim i As Long
With MSHFlexGrid1
tmp_a = 0
For i = 1 To .Rows - 1
'假设第三列为要合计的列
If .TextMatrix(i, 3) <> "" Then tmp_a = tmp_a + CDbl(.TextMatrix(i, 3))
Next i
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = "合计"
.TextMatrix(.Rows - 1, 2) = Format(tmp_a, "###0.00")
End With
End Sub
在控件中调用bt就可以了,例如:call bt
阅读(192) | 评论(0) | 转发(0) |