|
-
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
-
Mar 7th, 2002, 11:02 PM
#2
Member
hey willis, i dont know why you posted both of those code snippets. the fact that there are 2 is agravating me.. ... also if you are going to post 2 atleast comment to say what each sub is SUPPOSED to be doing... well from what i can see... i dont really know... reply and ID (ie. either summation of column, or summation of row) each sub routine for me. thanks.
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
|