|
百度云附件.求助啊..以前是一个文件一个文件手工导入的.网上收索到的宏都对不上号.急需大师求解
网上搬砖来的 - Sub tqwb()
- Dim a$, b$, i%
- Dim txtName
- txtName = Dir(ThisWorkbook.Path & "\*.txt")
- Range("a:c").ClearContents
- [a1:c1] = [{"文件名称","编号","数量"}]
- n = 2
- Do While txtName <> ""
- Open ThisWorkbook.Path & "" & txtName For Input As #1
- i = 1
- Do While Not EOF(1)
- Input #1, a, b
- Cells(n, 1) = Replace(txtName, ".txt", "")
- Cells(n, 2) = "'" & a
- Cells(n, 3) = b
- i = i + 1: n = n + 1
- Loop
- Close #1
- txtName = Dir
- Loop
- End Sub
复制代码
|
|