32 bit Excel on 64 bit CPU utilization?

pete6032

Diamond Member
Dec 3, 2010
7,483
3,039
136
I have a macro that does loop calculations using multiple combinations of formula inputs. I have 32 bit Excel 2010 on a 64 bit CPU. The macro takes about 30 mintues to run. I opened up task manager and the CPU utilization is staying around 32-35% with 200 MB of RAM used. Seems like the macro could use more CPU and complete faster. Is it not using more CPU because it is 32 bit Excel?
 

pete6032

Diamond Member
Dec 3, 2010
7,483
3,039
136
I found the issue. The macro is written in vba, which appears to only run on one thread.
 

Tweak155

Lifer
Sep 23, 2003
11,448
262
126
I found the issue. The macro is written in vba, which appears to only run on one thread.
I used to write VBA code for a living if you want some advice and are willing to share the code. I've never seen code run 30min or more that wasn't correctly optimized.

Sometimes quick wins can be had just by adding:
Code:
Application.ScreenUpdating = False 'Before code executes
Application.EnableEvents = False 'Only use this if you know your code doesn't rely on events (there is a problem if it does typically!!!)

Application.ScreenUpdating = True 'At the end, after all code
Application.EnableEvents = True 'Only needed if you used = False earlier

Just a comment on the above, while this may improve your performance, there is typically a number of more things that can be done if this is helping you.
 

pete6032

Diamond Member
Dec 3, 2010
7,483
3,039
136
I used to write VBA code for a living if you want some advice and are willing to share the code. I've never seen code run 30min or more that wasn't correctly optimized.

Sometimes quick wins can be had just by adding:
Code:
Application.ScreenUpdating = False 'Before code executes
Application.EnableEvents = False 'Only use this if you know your code doesn't rely on events (there is a problem if it does typically!!!)

Application.ScreenUpdating = True 'At the end, after all code
Application.EnableEvents = True 'Only needed if you used = False earlier

Just a comment on the above, while this may improve your performance, there is typically a number of more things that can be done if this is helping you.
Thanks for this post. I don't know much about VBA but I did some Google searching and ended up putting this into the code and now it runs substantially faster, much appreciated!