ronjon65
07-14-2018, 03:14 PM
I can read a text file with the following code, but the issue is that "RowEnd" must be known before hand. Is there a way to determine the textline where "This is the stop text" is and then feed that to RowEnd? I basically want it to stop reading in a certain point in the text file that is where a given textline occurs, not at a fixed value.
Do Until textline = "Start Line"
Line Input #1, textline
Loop
For j = RowStart To RowEnd
Line Input #1, textline
newline = Split(textline, ",")
Cells(j, 1) = newline(0)
Cells(j, 2) = newline(1)
Cells(j, 3) = newline(2)
Cells(j, 4) = newline(3)
Next j
Do Until textline = "Start Line"
Line Input #1, textline
Loop
For j = RowStart To RowEnd
Line Input #1, textline
newline = Split(textline, ",")
Cells(j, 1) = newline(0)
Cells(j, 2) = newline(1)
Cells(j, 3) = newline(2)
Cells(j, 4) = newline(3)
Next j