我想用宏把多个(200个)Sheet表中的内容合并到一个Sheet表中,手动复制太麻烦,使用宏很方便。下面这段代码能直接复制粘贴使用。
Sub 汇总数据()
Sheets.Add
With ActiveSheet
.Name = “汇总表” & Format(Now, “hhmmss”)
For Each s In ThisWorkbook.Sheets
s.UsedRange.Copy .Cells(.UsedRange.Rows.Count + 1, 1)
Next
End With
End Sub
Sheets.Add
With ActiveSheet
.Name = “汇总表” & Format(Now, “hhmmss”)
For Each s In ThisWorkbook.Sheets
s.UsedRange.Copy .Cells(.UsedRange.Rows.Count + 1, 1)
Next
End With
End Sub
评论