Results 1 to 8 of 8

Thread: code prob****RESOLVED****

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Posts
    100

    code prob****RESOLVED****

    I have flexgrid here.
    I want the system to substract maximum value and minimum value for every row in flexgrid.
    And the result will be displayed in column 'Julat'(pls see the attachment)

    My problem here is, the value for the column is 0(for every row).
    I cant figure out why is like that.
    Pls help.
    Thank U in advance.

    Snippet code as below :

    VB Code:
    1. Dim row As Long
    2.     Dim column As Long
    3.     Dim Max As Long
    4.     Dim Min As Long
    5.    
    6.     With MSFlexGrid7
    7.    
    8.      For row = 1 To .Rows - 1
    9.      
    10.          Max = Val(.TextMatrix(row, 2))
    11.          Min = Val(.TextMatrix(row, 2))
    12.          
    13.          'loop only for column 2 to column 5
    14.          For column = 2 To .Cols = 5
    15.          
    16.              If Min > Val(.TextMatrix(row, column)) Then
    17.                  Min = Val(.TextMatrix(row, column))
    18.              End If
    19.  
    20.              If Max < Val(.TextMatrix(row, column)) Then
    21.                  Max = Val(.TextMatrix(row, column))
    22.              End If
    23.              
    24.         Next
    25.        
    26.         .TextMatrix(row, 7) = Val(Max - Min)
    27.        
    28.      Next
    29.          
    30.     End With
    Attached Images Attached Images  
    Last edited by azrina; Mar 3rd, 2004 at 02:41 PM.

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