Microsoft Office Tutorials and References
In Depth Information
About Function Procedures
Figure 23-2: Use the References dialog box to create a reference to a project that contains a
custom VBA function.
h Create an add-in. When you create an add-in from a workbook that has Function
procedures, you don’t need to use the file reference when you use one of the functions in a
formula; however, the add-in must be installed. I discuss add-ins later in this chapter (see
the “Creating Add-Ins” section).
Using function arguments
Custom functions, like Excel’s built-in functions, vary in their use of arguments. Keep the
following points in mind regarding VBA Function procedure arguments:
h A function can have no argument.
h A function can have a fixed number of required arguments (from 1 to 60).
h A function can have a combination of required and optional arguments.
h A function can have a special optional argument called a ParamArray , which allows a
function to have an indefinite number of arguments.
See Chapter 25 for examples of functions that use various types of arguments.
All cells and ranges that a function uses should be passed as arguments. In other words, a
Function procedure should never contain direct references to cells or ranges.
Search JabSto ::

Custom Search