2,462
社区成员
发帖
与我相关
我的任务
分享
Sub file_txt()
Dim str_txt() As String, line As Integer, i As Integer, txt As String
line = 1
Open "D:\a.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, txt
str_txt = Split(txt, ",")
For i = 0 To UBound(str_txt)
Cells(line, i + 1).Value = str_txt(i)
Next i
line = line + 1
Loop
Close #1
ActiveSheet.Range(Cells(1, 1), Cells(1, ActiveSheet.UsedRange.Columns.Count)).Interior.ColorIndex = 6
End Sub