Subroutines and Functions
Tips, Tricks, and Answers
The following articles are available for the 'Subroutines and Functions' topic. Click the article''s title (shown in bold) to see the associated article.
Passing Parameters to Functions
Functions can be used to perform repetitive tasks and return values to your main program. You can also pass values to a function, however, which makes them even more useful.
Do some macro programming in VBA and you'll quickly find out that you can use functions to extend the power and flexibility of your programs. Here's why functions are so powerful and how you can put that power to work.
The heart of creating powerful programs in VBA is to understand how to create subroutines. These structures allow you to break your large programming tasks down into bite-sized chunks that can be used again and again.
Using Call to Run VBA Macros
An elegant way to run macros from within macros is to use the Call statement. In order to use it, you need to provide a reference from the calling project to the one being called.