Which bad practices/operations greatly slow down VBA macros?

AmericanSeiko

New Member
Joined
Sep 16, 2013
Messages
21
Hello

I've been writing long, computationally expensive macros lately, and have noticed that VBA is considerably slower at certain types of computations than others.

Copying/pasting, debug.prints, and Application.ScreenUpdating = True are some expensive operations that stand out to me.

I was wondering if you all knew others that should be avoided.

Looking forward to reading your tips/comments!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
AmericanSeiko,

What version of Excel and Windows are you using?

Can we see one of your macros, so that we may be able to suggest some improvements?

If posting VBA code, please use Code Tags - like this:

[code]

Paste your code here.

[/code]
 
Upvote 0
In larger workbooks, calculation time can cause delays. As long as you don't immediately need the result of the calculation, you can set to manual (xlCalculationManual). Otherwise, you can recalc just a single cell or small range instead of the entire workbook.


Tim
 
Upvote 0
Thanks for the replies.

Good idea about setting the calculations to manual. That's what I was wondering about. General Excel/VBA practices that seem obvious to veteran spreadsheet jockeys but are not truisms to novices.

I'd post my macros, but I wouldn't want you all to waste your time trying to optimize them as they are constantly changing.

Thanks again!
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top