I'm using Excel VBA to read through text files and the problem I'm having is capuring numbers after tags are identified. Below is what a sample of the text file:
A 1550.9 330.0
B 44.0 45.0
The tag is the letter "A" in the text file then I want to capture the number 1550.9. The problem is that if I go to another text file the number 1550.9 may be 998.5 which is one less charater than the previous text file. How do I make sure that no matter what text file I'm looking in I capture the all of the charaters for the number?
Here is what I have for code now:
Thanks for your help in advance!
A 1550.9 330.0
B 44.0 45.0
The tag is the letter "A" in the text file then I want to capture the number 1550.9. The problem is that if I go to another text file the number 1550.9 may be 998.5 which is one less charater than the previous text file. How do I make sure that no matter what text file I'm looking in I capture the all of the charaters for the number?
Here is what I have for code now:
Code:
If Left(TextLine, 1) = "A" Then
If cnt = 52 Then
If Right(Left(TextLine, 8), 6) < 500 Then
Workbooks.OpenText FileName:=sFile, Origin:=437, StartRow:= _
1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(7, 1), Array(100 _
, 1), Array(113, 1)), TrailingMinusNumbers:=True
End If
End If
End If
cnt =cnt +1