命令从下面第一个Sub开始:
Sub 合并不同工作簿的工作表到一个工作簿的不同工作表()
Excel.Application.ScreenUpdating = False
Dim ARR()
Dim WB As Workbook
Dim N As String
Dim SHT As Worksheet
Dim I As Integer
N = ActiveWorkbook.Name
On Error Resume Next
ARR = Application.GetOpenFilename(“Excel文件,.xls”, , “选择文件”, , True)
For I = LBound(ARR) To UBound(ARR)
Set WB = Workbooks.Open(ARR(I))
For Each SHT In WB.Sheets
With Workbooks(N)
SHT.Copy AFTER:=.Sheets(.Sheets.Count)
.Sheets(.Sheets.Count).Name = SHT.Name
End With
Next
WB.Close
Next
Sheets(1).Select
Excel.Application.ScreenUpdating = True
End Sub