mien Posted September 9, 2009 Posted September 9, 2009 im trying to get the min and max value for array data..but it seem not work.can someone help me with the code.. Private Sub getminval_Click() 'Get Minimum and maximum Value Dim strFileName As String Dim myFile As Integer Dim strTextLine As String Dim dblX(100000) As Variant Dim dblY(100000) As Variant Dim dblZ(100000) As Variant Dim arrText As Variant Dim strName As String Dim dblPt(2) As Double Dim diffZ As Double Dim minva, maxva As Integer Dim i As Integer Dim min(100000), max(100000) As Integer strFileName = mstrinpfile myFile = FreeFile If strFileName = "" Then MsgBox "No Data ", vbOKOnly, "HydroLab File Error" UserForm1.Show End If i = 1 min(0) = 0 max(0) = 0 Open strFileName For Input As #myFile Do While Not EOF(myFile) Line Input #myFile, strTextLine arrText = Split(strTextLine, ",") dblX(i) = arrText(0) dblY(i) = arrText(1) dblZ(i) = arrText(2) min(i) = dblZ(i) - min(i - 1) If min(i) < min(i - 1) Then minva = dblZ(i) minval.Text = minva ElseIf min(i) > min(i - 1) Then minva = dblZ(i - 1) minval.Text = minva End If max(i) = dblZ(i) - max(i - 1) If max(i) > max(i - 1) Then maxva = dblZ(i) maxval.Text = maxva ElseIf max(i) < max(i - 1) Then maxva = dblZ(i - 1) maxval.Text = maxva End If i = i + 1 Loop End Sub thanks... 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.