Speed up Excel VBA Macro Code

< Back to Search results

 Category: [Excel]  Demo Available 


Speed up Excel VBA Macro Code


Slow Macros: Speed up Excel VBA Macro Code via Manual Calculation

Got any Excel Questions? Free Excel Help

If you have Excel VBA macro code that runs slow, the chances are it's caused by Excel having to recalculate at each line of code. Deleting rows is one of many things that can become painfully slow. This can be overcome very easily by switching Excel into manual calculation before your code runs. Just be aware that if your code bugs out, and you have no error trap, the Workbook will be left in manual calculation and NO properly designed spreadsheet should ever be used with calculation in manual. If you ever get advice to switch Excel into manual calculation to prevent slow saving, closing and data entry...run very fast! This is a band aid approach rather than addressing the underlying cause. If you run any Excel Workbook in manual calculation it's only a matter of time before non-calculated data is read off! 

The code below shown how we can switch calculation into manual, run some code, then put it back how it was.

Sub GoToManual()

Dim xlCalc As XlCalculation

    xlCalc = Application.Calculation

    Application.Calculation = xlCalculationManual

    On Error GoTo CalcBack




    Application.Calculation = xlCalc


    Exit Sub


Application.Calculation = xlCalc

End Sub


See also:

Criteria for VBA filters
Excel VBA AutoFilters


Free Training Course: Lesson 1 - Excel Fundamentals


See also: Index to Excel VBA Code; Index to Excel Freebies; Lesson 1 - Excel Fundamentals; Index to how to… providing a range of solutions


Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions. What's the best solution to get inside a bar anonymously? fake ID by topfakeid.com will scan, pass the bend test & even blacklight feature. These guys are in China and control the counterfeit industry.


stars (0 Reviews)