If blnStartReading1 = True And blnStartReading2 = False Then
i = InStr(strTestData, "174=")
ii = InStr(i + 1, strTestData, ";")
If i < ii And i <> 0 Then
strDepth = Mid(strTestData, i, ii - i)
End If
blnStartReading2 = True
End If
If strTestData = "EndHeader" Then blnStartReading1 = True
If strTestData = "STOP" Then blnStartReading2 = False
Wend
Close #2
End Sub
From the "text.txt" file,i only need the value inside "START 43, L, 174=0;133=300000" and "STOP" to change to the format below. By using the code above,i found mistake was happen(the blue color). i don't need to save the blue color value.
3.85663000 100.81888000 174=0
3.85625000 100.81778000 174=0
3.85519000 100.80883000 174=0
3.20013000 101.29401000 174=20
3.20232000 101.29359000 174=20
3.20748000 101.29134000 174=20
2.85667000 99.98843120 174=20
2.85667000 99.70000000 174=20
3.19926000 99.70000000 174=20
3.73802000 100.94623000 174=20
3.73897000 100.94658000 174=20
3.74430000 100.94950000 174=20
3.76365000 100.98286000 174=20
Print #1, Join(resarr, vbNewLine) ' print all lines in group to file
Loop
Close 1
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
change the initial search string to find the start position so that it will work with all your strings,
i thought you only wanted to find the ones that had 174 = something so i searched upto the 174, if you want all values, just search to the "L"
if you need more help, give more examples of ones you want to include and ones you want to exclude, i only worked to the sample file you posted
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete