The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Tips for Defining Procedures in VBA

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

When you are defining a Function or Sub procedure, you have options available to you that can make your code more extensible or more flexible. The following sections discuss how to extend your procedures by using optional arguments, using parameter arrays to pass a variable number of arguments, and passing arguments by value and by reference.

In This Section

Using Optional Arguments
Add functionality without updating all the code that calls those procedures by adding optional arguments to user-defined procedures.
Using Parameter Arrays
Pass an array of arguments to a procedure by using a parameter array.
Passing Arguments by Value or by Reference
Understand the difference between passing arguments by value and passing arguments by reference when you define a procedure.

Related Sections

Getting the Most Out of Visual Basic for Applications
Write code that is fast, efficient, easy to read and maintain, and, if possible, reusable by acquiring a solid working knowledge of Microsoft® Visual Basic® for Applications (VBA) — what features the language includes and what you can do with it.
Working with Strings
Understand how to get information from strings.
Working with Numbers
Learn how to use numeric values and data types in Microsoft® Visual Basic® for Applications (VBA).
Working with Dates and Times
Manipulate date values in Microsoft® Visual Basic® for Applications (VBA), and understand how VBA stores date values internally.
Working with Files
Understand the Scripting Runtime object library, and work with drives, folders, and files as objects.
Understanding Arrays
Use arrays when you must store a number of values of the same type, but you do not want to create individual variables to store them all.
Optimizing VBA Code
Understand how to streamline your Microsoft® Visual Basic® for Applications (VBA) code to streamline your memory requirements.
© 2015 Microsoft