我正在尝试将多个工作表复制到新工作簿。我需要将不同工作簿中的3张表复制到一张表中的新创建工作簿中。
这是我的代码:
Private Sub CommandButton1_Click()
Path = "C:\Users\vnohavcova\Desktop\New folder\DB earnie report\"
fileName = Dir(Path & "*.xls")
Do While fileName <> ""
Workbooks.Open fileName:=Path & fileName, ReadOnly:=True
For Each sheet In ActiveWorkbook.Sheets
sheet.Copy After:=DestWkb.Sheets(1)
Next sheet
Workbooks(fileName).Close
fileName = Dir()
Loop