|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 汇总()
- r = [a65536].End(3).Row
- arr = Range("a1:b" & r)
- Set fso = CreateObject("scripting.filesystemobject")
- Set ff = fso.getfolder(ThisWorkbook.Path)
- For Each f In ff.Files
- If InStr(f, "~$") = 0 And f <> ThisWorkbook.FullName Then
- xstr = Split(f.Name, ".")(0)
- Workbooks.Open f
- Set wb = ActiveWorkbook
- For i = 1 To UBound(arr)
- If arr(i, 1) = xstr Then arr(i, 2) = wb.Worksheets(1).[a1]: Exit For
- Next
- ActiveWorkbook.Close False
- End If
- Next
- Range("a1:b" & r) = arr
- End Sub
复制代码 |
|