|
Sub 汇总()
Dim i As Integer, irows As Integer, k As Integer
For Each t In Worksheets
If t.Name = "汇总" Then
Application.DisplayAlerts = False
t.Delete
Application.DisplayAlerts = True
Exit For
End If
Next
Sheets.Add After:=ActiveSheet
ActiveSheet.Name = "汇总"
Sheets("汇总").Select
Worksheets("汇总").Cells.ClearContents
Worksheets("汇总").Range("a1").Resize(1, 33).Value = Worksheets(1).Range("a1").Resize(1, 33).Value
For i = 1 To Worksheets.Count - 1
irows = Worksheets(i).Range("a1").CurrentRegion.Rows.Count
k = Worksheets("汇总").Range("a1").CurrentRegion.Rows.Count + 1
Worksheets("汇总").Range("a" & k).Resize(irows, 33).Value = Worksheets(i).Range("a1").CurrentRegion.Offset(1, 0).Value
Next i
End Sub
如附件,目前我的代码是将所有工作表的内容复制到汇总表中,如何将我鼠标选定的几个工作表内容复制汇总过去
|
|