ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   C++ instead of VB for excel macros (https://www.excelbanter.com/excel-programming/305847-c-instead-vbulletin-excel-macros.html)

Rimcon

C++ instead of VB for excel macros
 
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?

--
GP

Keith Willshaw[_2_]

C++ instead of VB for excel macros
 

"Rimcon" wrote in message
...
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?

--
GP


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




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com