|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 汇总()
Dim arr, r&, sh As Worksheet
Sheets("汇总").UsedRange.Offset(1).ClearContents
For Each sh In ThisWorkbook.Worksheets
If sh.Name <> "汇总" Then
With sh
r = .Cells.Find("*", .Cells(1, 1), xlValues, xlWhole, xlByRows, xlPrevious).Row '计算工作表最后一个非空行号
arr = .[a2].Resize(r - 1, 4)
End With
With Sheets("汇总")
r = .Range("A:A").Find("*", .Cells(1, 1), xlValues, xlWhole, xlByRows, xlPrevious).Row '计算工作表最后一个非空行号
.Cells(1, 1).Offset(r).Resize(UBound(arr, 1), UBound(arr, 2)) = arr
End With
End If
Next
End Sub
|
|