これはVBAで何もコーディングしていない初めてのことです。ファイルを読み込んでビットとピースをwestまたはcolumnのどちらかの列に分ける短いマクロを作成しようとしています。VBAでの単純なループが動作しない
すべてが間違っているかもしれませんし、単純なものかもしれませんが、現時点では私のdoループも認識しません。どんな助けも大歓迎です。
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(x1Up) = text
If west = False Then
Sheets("Sheet2").Range("East").End(x1Up) = text
Loop
Close #1
End Sub
として実際のパスと名前を持つために必要な必要があります'End If' –