我需要将两个单独的数据列从一个工作簿复制到另一个工作簿。
这是我的代码:
Workbooks.Open Filename:=file & "\GSP - " & months(numMonth) & " 1-" & numdays (numMonth) & " " & tYear & " - Prem.xls", _
Origin:=xlWindows, UpdateLinks:=False, ReadOnly:=True
ActiveWorkbook.Sheets(tDay).Activate
range("AA6:AA40").Select
Selection.Copy
Windows(fileM & ".xls").Activate
Sheets("Summary").Activate
range("C3:C37").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveWorkbook.Close
ActiveWindow.Close
Workbooks.Open Filename:=file & "\GSP - " & months(numMonth) & " 1-" & numdays(numMonth) & " " & tYear & " - Prem.xls", _
Origin:=xlWindows, UpdateLinks:=False, ReadOnly:=True
ActiveWorkbook.Sheets(tDay).Activate
range("AA84:AA118").Select
Selection.Copy
Windows(fileM & ".xls").Activate
Sheets("Summary").Activate
range("H3:H37").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveWorkbook.Close
ActiveWindow.Close
当宏完成运行时,第二个副本没有完成,我在第二个 Windows(fileM & ".xls").Activate' 的中断处留下错误 9