Reputation: 11
I have written a VBA script in Excel that calculates iteratively a range of physical variables and, at each iteration, re-calculates the values of other correlated variables in the worksheet.
I have run the code from the Visual Basic editor in order to monitor the value of some variables at each iteration through the Immediate Window. I was surprised to notice a sudden acceleration of the execution simply by clicking with the mouse on the Immediate Window, or by pressing Enter. On the contrary, when the VBA script is run from the spreadsheet, its speed of execution is about five time slower, and I found no way to accelerate it.
I wonder what is the reason of the acceleration in the execution when clicking on the Immediate Window and how I could speed up the code without this trick.
I am using Excel 2013 and Windows 8.1.
Upvotes: 1
Views: 383
Reputation: 49
Application.ScreenUpdating = False
Application.Calculation = xlManual
at the beginning of the script and
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
at the end of the script might possible result in the same speed up that you get by focussing the immediate-Window.
Upvotes: 0