Microsoft Office Tutorials and References
In Depth Information
Figure 24-2: Use the References dialog box to create a reference to a project that contains a custom
By default, all projects are named VBAProject — and that's the name that appears in
the Available References list in the References dialog box. To make sure that you select
the correct project in the References dialog box, keep your eye on the bottom of the
dialog box, which shows the path- and filename for the selected item. Better yet,
change the name of the project to be more descriptive. To change the name, select the
project, press F4 to display the Properties window, and then change the Name property
to something other than VBAProject. Use a unique name because Excel does not let
you create two references with the same name.
• 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:
• A function can have no argument.
• A function can have a fixed number of required arguments (from 1 to 60).
• A function can have a combination of required and optional arguments.