- #1
turkcyclone
- 9
- 0
Hi, I have this text file.
"3 4
7.21 -5.7 0.01 9.0
5.6 0.11 -.123 14.
2.11 4.11 0.0001 -2. "
I am trying to create a VBA program to find the Minimum value, but I keep getting an error. Could someone help me? I am trying to get some practice for a test. Here is what I have so far...
Option Explicit
Sub test()
Dim A(1 To 3, 1 To 4) As Single, low, nrows, ncols As Single, i, j As Integer
Open ("C:\pathname\in_class_input_file.txt") For Input As #1
Open ("C:\pathname\in_class_output_file.txt") For Output As #2
Input #1, nrows, ncols
For i = 1 To nrows
For j = 1 To ncols
Input #1, A(i, j)
Next j
Next i
For i = 1 To nrows
For j = 1 To ncols
low = A(1, 1)
If A(i + 1, j) < low Then
low = A(i + 1, j)
Else
'Next j
'Next i
End If
Next j
Next i
Print #2, "The"; "lowest"; "Value Is"; low
Close #1
Close #2
End Sub
"3 4
7.21 -5.7 0.01 9.0
5.6 0.11 -.123 14.
2.11 4.11 0.0001 -2. "
I am trying to create a VBA program to find the Minimum value, but I keep getting an error. Could someone help me? I am trying to get some practice for a test. Here is what I have so far...
Option Explicit
Sub test()
Dim A(1 To 3, 1 To 4) As Single, low, nrows, ncols As Single, i, j As Integer
Open ("C:\pathname\in_class_input_file.txt") For Input As #1
Open ("C:\pathname\in_class_output_file.txt") For Output As #2
Input #1, nrows, ncols
For i = 1 To nrows
For j = 1 To ncols
Input #1, A(i, j)
Next j
Next i
For i = 1 To nrows
For j = 1 To ncols
low = A(1, 1)
If A(i + 1, j) < low Then
low = A(i + 1, j)
Else
'Next j
'Next i
End If
Next j
Next i
Print #2, "The"; "lowest"; "Value Is"; low
Close #1
Close #2
End Sub