发布网友
共1个回答
热心网友
根据你的截图,大概可以用如下的方式做出来~Ia、Ib、Ic.....一直到f,先写到excel 中,有问题再提出。
Sub read_txt()
j = 1
n = Cells(1, Columns.Count).End(xlToLeft).Column
Filename = "C:\Users\Administrator\Desktop\1.txt"
Open Filename For Input As #1
Do While Not EOF(1)
Line Input #1, mystr
If Trim(mystr) <> "" Then
j = j + 1
arr = Split(mystr, " ")
Cells(j, 1) = arr(0) & " " & arr(1)
For i = 2 To n
Cells(j, i) = Application.Substitute(arr(i), Cells(1, i) & ":", "")
Next
End If
Loop
Close #1
End Sub