Forum Discussion
Olivierb61
Feb 08, 2022Copper Contributor
Macros suddenly run much slower
I noticed that excel 365 macros suddenly take much longer to run. Seems to be correlated with the latest update of excel done on february 3rd on my machine
timfrewin
Feb 14, 2022Copper Contributor
I had this same problem. Something has clearly changed on MS's side. Some macros which used to take around 30 secs were taking anywhere from 20 mins to 2.5 hours. This was a sudden change early last week. However, we've found a fix. Once we disabled automatic formula recalculation during execution of the macro, everything went back to normal. If anything, faster than before.
At the beginning of each function:
Application.Calculation = xlCalculationManual
At the end of each function:
Application.Calculation = xlCalculationAutomatic
Or, a better way, if you want to preserve the user settings of automatic vs manual calculation following completion of the macro:
Sub x()
lCalc = Application.Calculation
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
.DisplayAlerts = False
''///your code here
.Calculation = lCalc
.ScreenUpdating = True
.DisplayAlerts = True
End With
End Sub
(Credit to user royUK on https://www.ozgrid.com/ forum for that addition and code snippet)
Steve_Pigsoft
Feb 14, 2022Copper Contributor
Olivierb61 Thanks for the suggestion which worked for you ( Application.Calculation = xlCalculationManual + At the end of each function: Application.Calculation = xlCalculationAutomatic). Unfortunately, this does not fix the problem for me. I tried it - There are problems elsewhere in MS's code for latest Excel 365 releases. Their code needs fixing. Still, glad to hear that your macros are now back to speed