mien Posted September 30, 2009 Posted September 30, 2009 hi..i tyr to get min and max value from array text.but it seem not working, the code should compare the from first line to end of file..can someone help me with the code.thanks. Private Sub getminval_Click() 'Get Minimum and maximum Value Dim strFileName, strTextLine As String Dim arrText As Variant Dim min, max As Double Dim strName As String Dim i, myFile As Integer Dim x(100000), y(100000), z(100000) As Double strFileName = mstrinpfile myFile = FreeFile If strFileName = "" Then MsgBox "No Data ", vbOKOnly, "File Error" GoTo 10 End If i = 1 Open strFileName For Input As #myFile Do While Not EOF(myFile) Input #myFile, x(i), y(i), z(i) min = z(0) max = z(0) If i > 1 Then If z(i) < z(i - 1) Then min = z(i) minval.Text = min End If If z(i) > z(i - 1) Then max = z(i) maxval.Text = max End If End If i = i + 1 Loop 10 End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.