|
楼主 |
发表于 2017-2-9 19:28
|
显示全部楼层
不知道速度能不能 再快一点啊
Sub 汇总所有数据()
Application.ScreenUpdating = False
[a5:n8888] = ""
Dim myPath$, myFile$, nm$, s%, r&, arr, wb As Workbook
myPath = ThisWorkbook.Path & "\"
myFile = Dir(myPath & "*.xls")
Do While myFile <> ""
If myFile <> ThisWorkbook.Name Then
Set wb = GetObject(myPath & myFile)
arr = wb.Worksheets(1).[a5:n8888] '可调成合适的区域
With ThisWorkbook.Worksheets(1)
r = .Cells(.Rows.Count, 2).End(xlUp).Row
If r < 4 Then r = 4
.Range("a" & r).Offset(1).Resize(UBound(arr), UBound(arr, 2)) = arr
End With
wb.Close False
End If
myFile = Dir
Loop
Application.ScreenUpdating = True
End Sub
|
|