C++ instead of VB for excel macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm running 50,000 scenarios in a VB macro that involves looping through a 90 x 90 array. It takes 3 hours to run -- after implementing the macro speed-up tips I've received. I'm thinking about learning C++ to build a faster addin. Any comments on whether this is worthwhile? Or how much I should be able to cut the run time?
 
Rimcon said:
I'm running 50,000 scenarios in a VB macro that involves looping through a
90 x 90 array. It takes 3 hours to run -- after implementing the macro
speed-up tips I've received. I'm thinking about learning C++ to build a
faster addin. Any comments on whether this is worthwhile? Or how much I
should be able to cut the run time?
Depends what the scenarios are doing.

If you are using Excel functions you are unlikely to see
a significant improvement in speed. The C++ code
may well execute faster but the OLE calls still have
to go through the same interfaces and the same
Excel funcions are called.

If you re-write the functions in C++ you may see
an increase in performance but I'd only advise that
if you are an experience C++ developer.

If not you may want to consider used VB.net or
C# which IMHO are easier to learn for the experienced
VB programmer. I'm currently doing something similar though
in my case its the factor of running out of memory in Excel
and security of the code more than speed thats driving it.

I dont know what tips you have been given but
turning off events, screenupdating and autocalculation
all give more significant speed advantages than simply
compiling the VBA code in my experience.

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top