|
-
Mar 6th, 2002, 10:00 PM
#1
Thread Starter
Member
A Newbies Question about the sum?
Hi all!
I am working with msflexgrid control.i know i to get the sum of each col ,but how can i get the sum of each row. it does'nt work.
Why?
Private Sub MSFlexGrid1_Calcul()
Dim numVal As Double
Dim c As Integer
Dim r As Integer
For c = 2 To MSFlexGrid1.cols -1
numVal = 0
For r = 2 To MSFlexGrid1.rows - 1
numVal = numVal + Val(MSFlexGrid1.TextMatrix(r, c))
Next r
MSFlexGrid2.TextMatrix(0, c) = numVal
Next c
End Sub
Why this one does'nt work?:
Private Sub MSFlexGrid1_Calcul()
Dim numVal As Double
Dim c As Integer
Dim r As Integer
For c= 1 To MSFlexGrid1.cols -1
numVal = 0
For r = 1 To MSFlexGrid1.rows - 1
numVal = numVal + Val(MSFlexGrid1.TextMatrix(r, c))
Next r
MSFlexGrid1.TextMatrix(r, 0) = numVal
Next c
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|