【发布时间】:2019-07-06 19:58:32
【问题描述】:
此代码是拉出多张工作表并粘贴到另一个工作簿中以保存为历史文件,但它不断导致系统崩溃......有什么想法吗?
Sub TransAll()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Windows("Inventory.xlsm").Activate
Sheets(Array("Invoice Log", "Beer Inventory", "Liquor Inventory", "Wine
Inventory" _
, "Food Inventory", "Other Inventory", "Transfer Worksheet")).Select
Sheets(Array("Invoice Log", "Beer Inventory", "Liquor Inventory", "Wine
Inventory" _
, "Food Inventory", "Other Inventory", "Transfer Worksheet")).Copy
Before:= _
Workbooks("TransManager.xlsm").Sheets(1)
Windows("PrimeCost.xlsm").Activate
Sheets(Array("Sales", "Labor", "Cost of Sales", "Prime Cost")).Select
Sheets(Array("Prime Cost", "Sales", "Labor", "Cost of Sales")).Copy
Before:= _
Workbooks("TransManager.xlsm").Sheets(1)
Application.DisplayAlerts = True
End Sub
【问题讨论】:
-
如果你使用
F8单步执行,你能找出导致崩溃的那一行吗? -
它想在 Windows("PrimeCost.xlsm").Activate 部分标记
标签: arrays excel vba performance copy