Results 1 to 2 of 2

Thread: A Newbies Question about the sum?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2002
    Location
    Canada
    Posts
    50

    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

  2. #2
    Member FaRd0wN's Avatar
    Join Date
    Mar 2002
    Posts
    32
    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.
    vBchode enabled

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width