Microsoft Office Tutorials and References
In Depth Information
• A function can have a special optional argument called a ParamArray, which allows a function to have an
indefinite number of arguments.
See Chapter 26 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.
Using the Insert Function Dialog Box
Excel's Insert Function dialog box is a handy tool that enables you to choose a particular worksheet function
from a list of available functions. The Insert Function dialog box also displays a list of your custom worksheet
functions and prompts you for the function's arguments.
Custom Function procedures defined with the Private keyword don't appear in the In-
sert Function dialog box. Declaring a function as Private is useful if you create func-
tions that are intended to be used by other VBA procedures rather than in a formula.
By default, custom functions are listed under the User Defined category, but you can have them appear under a
different category. You also can add some text that describes the function.
Adding a function description
When you select one of Excel's built-in functions in the Insert Function dialog box, a brief description of the
function appears (see Figure 24-3). You may want to provide such a description for the custom functions that