Rich Hamm
Rich Hamm

Reputation: 41

Stop multithreading in Excel from VBA

I am running into problems with the speed of my macros. I already turn off calculations and turn them back on. I turn off screen updating then turn it back on. Simply put I have tried all the tricks to speed up the macro execution. While executing, it shows thread calculation in the bottom right of the screen. I would like to be able to turn multithreading off programmatically so I do not have to tell people to do it manually when I give them the file to us. Is there a way to do this?

Upvotes: 0

Views: 2431

Answers (2)

Rich Hamm
Rich Hamm

Reputation: 41

After doing some more research, I did find the answer. Turning off events, screen updating and making calculations manual does not solve the problem. But this does:

Application.MultiThreadedCalculation.Enabled = False

If you put this in your script you may see a significant improvement in performance. I know I did!

Upvotes: 1

xShen
xShen

Reputation: 572

This is working for me

    Sub turnOffCalc()
    Application.Calculation = xlCalculationManual
    Application.ScreenUpdating = False
    Application.EnableEvents = False

End Sub

Sub turnOnCalc()
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
    Application.EnableEvents = True

End Sub

Upvotes: 0

Related Questions