This is my first time coding anything in VBA - I am trying to write a short macro which reads a file and separates bits and pieces into either column west or column east.
All of it could be wrong or it could just be something simple, but at the moment it won't even recognize my do loop. Any help is much appreciated.
Private Sub seperateTextFile()
Dim file As String
Dim text As String
Dim textLine As String
Dim west As Boolean
west = True
file = ".alltxt"
Open file For Input As #1
Do Until EOF(1)
Line Input #1, textLine
text = textLine
If InStr(text, "HMW") <> 0 Then
west = True
If InStr(text, "other") <> 0 Then
west = False
If west = True Then
Sheets("Sheet2").Range("West").End(xlUp) = text
If west = False Then
Sheets("Sheet2").Range("East").End(xlUp) = text
Loop
Close #1
End Sub
If {test} Then {Action}is all on one line it requires anEnd If