Can VB execute VBA code?

T

TomThumb

My VBA macro runs slowly in Excel 2007. Will Visual Basic compile my VBA
macro into a faster application that I can somehow use with my Excel
spreadsheet?
 
D

dmoney

yes - with slight code changes -- you will have to reference the excel object
from within vb.
 
S

Sheeloo

VBA is a subset of VB... you can run Excel code but will it be faster? First
try to see why your code is slow... then if you find that it is slow because
it runs in Excel then move to VB...

You may send the file to me if it does not contain confidential information
so that I can take a look.
 
C

Charles Williams

It is very unlikely that compiling your VBA macro using VB6 will make it run
any faster.

The only known exceptions are:
- using a large number (1000s) of VBA UDFs (bypassable in Manual Mode)
- very intensive arithmetic (eg iteratively solving partial differential
equations)

Make sure you have:
- switched off the Google Office COM Addins
- used Application.Screenupdating=False
- switched to manual calculation mode
- cleaned up your code to eliminate selecting ranges
- transferred data between Excel and VBA in large blocks using variant
arrays

regards
Charles
__________________________________________________
The Excel Calculation Site
http://www.decisionmodels.com
 
T

TomThumb

Since there seems to be disagreement as to a speed advantage for VB over VBA,
I will try manual calculation mode as a cheap fix. Thanks to you all (3).
 

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

Top