Hello djmal,
This macro will parse the data from the starting node to the ending node and copy it to the ActiveSheet starting in cell "A1". Be sure to change the variables StartNode, EndNode, and the FileSpec to what you need.
Macro Code
Sub CopyTextFile()
Dim EndFound As Boolean
Dim EndNode As String
Dim FileSpec As String
Dim FN As Integer
Dim N As Long
Dim Node As String
Dim NodeData() As Variant
Dim StartFound As Boolean
Dim StartNode As String
Dim Text
StartNode = "A73"
EndNode = "Z1"
FileSpec = "C:\Documents and Settings\djmal\My Documents\sample.txt"
FN = FreeFile
Application.ScreenUpdating = False
Open FileSpec For Input As #FN
Do While Not EOF(FN)
Line Input #FN, Text
Node = Trim(Left(Text, 4))
If Node = StartNode Then StartFound = True
If StartFound Then ReDim Preserve NodeData(N): NodeData(N) = Text: N = N + 1
If Node = EndNode Then EndFound = True
If Node <> "" And StartFound And EndFound Then
Range("A1").Resize(N - 1, 1).Value = WorksheetFunction.Transpose(NodeData)
End If
Loop
Close #FN
Application.ScreenUpdating = True
End Sub
[/code]
Bookmarks