|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- 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
复制代码 |
|