VBA代码
Sub 多表合并()
Dim arr()
For Each sh In Sheets
If sh.Name <> "汇总" Then
arr1 = sh.Range("a2:c" & sh.UsedRange.Rows.Count)
act = act UBound(arr1)
ReDim Preserve arr(1 To 3, 1 To act) '
For j = 1 To UBound(arr1)
n = n 1
arr(1, n) = arr1(j, 1)
arr(2, n) = arr1(j, 2)
arr(3, n) = arr1(j, 3)
Next
End If
Next
Sheets("汇总").[a2].Resize(n, 3) = Application.Transpose(arr)
End Sub
将文件另存为xlsm格式,要不然重新打开文件时这段代码就消失了!
觉得好用的可以收藏分享给你的朋友哦!
---------------------------------
欢迎关注,更多精彩内容持续更新中....
学习5分钟,工作省2小时!