Hello, I am looking for help in optimizing an Excel workbook I have. I am using Windows 7 64-bit SP1. Excel 2010. MS Access 2003. This workbook contains links through a shared drive to multiple other excel worksheets. It also contains data connections to Access 2003 select queries. I have VBA that on the workbook open, each link from the external Excel files and each Access query connection is refreshed. The file then saves and closes. The total file size is 13.5MB. The Access queries return about 5,000 records per tab on 6 tabs. The external links have 2,000 records on 3 tabs, and 10,000 records on two tabs. The issue is that the file currently taking anywhere from 2-6 hours to completely update and close the file. Is there a way to optimize the excel file so that it runs faster? On workbook open the VBA that is executed is (this is in the 'ThisWorkbook' object: Private Sub Workbook_Open()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Call UpdateForecastandActuals
Application.ScreenUpdating = True
Application.Quit
End Sub The macro that is called is saved in 'Module1':
Sub UpdateForecastandActuals()
'
' UpdateForecastandActuals Macro
'
'
Application.Calculation = xlManual
Application.Calculation = xlAutomatic
Calculate
Sheets("Frozen Forecast").Select
Calculate
Sheets("Frozen - Commodity Forecast").Select
Calculate
Sheets("Perishable Forecast").Select
Calculate
Sheets("Perishable - Commodity Forecast").Select
Calculate
ActiveWorkbook.RefreshAll
Sheets("Grocery Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Frozen Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Perishable Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Frozen - Commodity Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Perishable - Commodity Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("WeeklyPPP").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Grocery Forecast").Select
Range("A1").Select
ActiveWorkbook.save
End Sub
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Call UpdateForecastandActuals
Application.ScreenUpdating = True
Application.Quit
End Sub The macro that is called is saved in 'Module1':
Sub UpdateForecastandActuals()
'
' UpdateForecastandActuals Macro
'
'
Application.Calculation = xlManual
Application.Calculation = xlAutomatic
Calculate
Sheets("Frozen Forecast").Select
Calculate
Sheets("Frozen - Commodity Forecast").Select
Calculate
Sheets("Perishable Forecast").Select
Calculate
Sheets("Perishable - Commodity Forecast").Select
Calculate
ActiveWorkbook.RefreshAll
Sheets("Grocery Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Frozen Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Perishable Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Frozen - Commodity Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Perishable - Commodity Actuals").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("WeeklyPPP").Select
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
Sheets("Grocery Forecast").Select
Range("A1").Select
ActiveWorkbook.save
End Sub