VBA is freezing

Copper Contributor

For some reason I added some code to my vba that I thought would speed things up but now the code sometimes freezes (30 seconds and eventually finishes) when running and other times not even though I am doing the exact same work and data entry on different workbooks formatted to use the same code 

 

Application.ScreenUpdating = False

Application.DisplayAlerts = False

 

then later I set these to True.  

 

I have some popups going in the code as well where I have to click ok to close them but they seem to show up after the code is ran.  

 

 

1 Reply
With complex Excel spreadsheets, it is often disadvantageous if data calculation is active while data is being written to the spreadsheet. VLOOKUP and other rules are run with each new record and slow down the generation process.

Excel offers to simply deactivate the formula calculation manually.

at the beginning insert
.Calculation = xlCalculationManual

and in the end
.Calculation = xlAutomatic

or w/out VBA go under Extras, Options, Calculation, uncheck "Automatically recalculate".