How do I suspend auto cals in MS Excel when running a VBA module

upobDaPlaya
upobDaPlaya used Ask the Experts™
on
In a VBA module I turn off auto calculations at the beginning of the code.  At the end I turn it back on, but this is problematic as when I turn it back on in the code it re-ca calculates and takes forever since I have a lot of CountIFS and SUMIFS...

Any suggestions...

I
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It sounds like you are already doing what you are asking for.  At some point, you are going to have to calculate the sheet, and if it takes a long time doing it automatically, it will still be slow doing it manually.

You might want to look into array functions in Excel, as they are much more efficient than lots of countifs/sumifs:
http://office.microsoft.com/en-ca/excel-help/introducing-array-formulas-in-excel-HA001087290.aspx

You can turn off autocalculation in Excel options(In Excel 2010, click File, Options), under the Formulas section.  You can then perform a manual calculation by pressing F9.
You can give this a try:

    With Application
        .Calculation = xlCalculationAutomatic
        .CalculateBeforeSave = False
    End With

Flyster

Author

Commented:
Sterling, I took a look at arrays and it makes sense.  However, how can I utilize arrays if I have several conditions to be met prior to a sum.  For example if cell A3 has to be >0 and B3>50 prior to summing certain cells how would I replace the SUMIF with an array ?

Flyster,

In the interim I will give your suggestion a shot.

Author

Commented:
thank you...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial