function or call macro

  • Thread starter Thread starter marko
  • Start date Start date
M

marko

Hi all,
Is there much of a difference between creating a function to use only in a
macro or creating seperate macro's (not to be used independantly) and
calling them from another master macro?
Is one method faster than the other?
I'm just looking for some best practice tips:-)

Marko
 
My understanding is that doing something inline is always faster than
calling a procedure external to the one that's running. Unless you have many
calls to outside procedures, though, this difference will be imperceptible.
 
embedding the code in the primary macro will run faster
than writing a separate function and calling it from the
primary macro. However, modularizing your code has its
own advantages, e.g., much easy to write, understand,
maintain, etc., and you are more likely to think about
execution speed and efficiency when writing subroutines
for reuse. Walkenbach's book, Excel 2000 Power
Programming with VBA, discusses several exectution speed
issues including the advantages of using Excel's built-in
functions vs writing your own.
 
I'd go with well written functions rather than one long module. Easier to
maintain, more solid and doubtful there'll be a decrease in performance.
 
Back
Top