txt文件批量导入EXCEL有1000
Sub InputTxtdata()
Dim Fso As Object, Fl, i%
Dim Sh As Worksheet
Set Sh = ActiveSheet
Set Fso = CreateObject("Scripting。 FileSystemObject")
For Each Fl In tfolder(ThisWorkbook。Path & "\")。Files
If Fl。Name Like "*。 txt" Then
i = i + 1
Range("A1")(1, i) = Replace(Fl。Name, "。txt", "")
Workbooks。 ...全部
Sub InputTxtdata()
Dim Fso As Object, Fl, i%
Dim Sh As Worksheet
Set Sh = ActiveSheet
Set Fso = CreateObject("Scripting。
FileSystemObject")
For Each Fl In tfolder(ThisWorkbook。Path & "\")。Files
If Fl。Name Like "*。
txt" Then
i = i + 1
Range("A1")(1, i) = Replace(Fl。Name, "。txt", "")
Workbooks。
OpenText Fl
With ActiveWorkbook
。ActiveSheet。Range("A1", ActiveSheet。
[A1]。End(4))。Copy Sh。Range("A1")(2, i)
。Close False
End With
End If
Next
End Sub
。
收起