Hello,
I just used CalculationManual in some code I modified from the internet, like below:
Sub RemoveHTMLTags()
Dim wb As Workbook
Dim ws As Worksheet
Dim myrange As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set wb = ActiveWorkbook
Set ws = ActiveSheet
'Code
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
I ran across 2 articles that said that there was a drawback to using CalculationManual and I don't understand what they are saying on a couple of points and was hoping someone could explain:
1. They said 'This is a band aid approach (using Manual Calculation) rather than addressing the underlying cause' - I guess he is referring to efficient spreadsheet design, like faster formulas, etc.?
2. They said, 'If you run any Excel Workbook in manual calculation it's only a matter of time before non-calculated data is read off!' - What does that mean, 'read off'?
Full quote:
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! See Efficient Spreadsheet Design .
3. Should there be any concern in putting Excel in manual calculation at the beginning of the code as the quote says below b/c you're going to turn it back on for the other worksheets, too, at the end of the code, correct?
There is an important caveat to remember in relation to using this macro. You can only set the calculation mode for the application as a whole. Thus, with automatic recalculation turned off, no other worksheets will be automatically recalculated, either.
Thank you in advance for your help.
Sources:
http://www.ozgrid.com/VBA/calc-stop.htm
https://excel.tips.net/T001988_Forci..._Workbook.html
Bookmarks