11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 23: Function Procedure Basics 619<br />

Figure 23-2: Use the References dialog box to create a reference to a project that contains a<br />

custom VBA function.<br />

Create an add-in. When you create an add-in from a workbook that has Function procedures,<br />

you don’t need to use the file reference when you use one of the functions in a<br />

formula; however, the add-in must be installed. I discuss add-ins later in this chapter (see<br />

the “Creating Add-Ins” section).<br />

Using function arguments<br />

Custom functions, like Excel’s built-in functions, vary in their use of arguments. Keep the following<br />

points in mind regarding VBA Function procedure arguments:<br />

A function can have no argument.<br />

A function can have a fixed number of required arguments (from 1 to 60).<br />

A function can have a combination of required and optional arguments.<br />

A function can have a special optional argument called a ParamArray, which allows a<br />

function to have an indefinite number of arguments.<br />

See Chapter 25 for examples of functions that use various types of arguments.<br />

All cells and ranges that a function uses should be passed as arguments. In other words, a<br />

Function procedure should never contain direct references to cells or ranges.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!