Adding a function description

When you select a function in the Insert Function dialog box, a brief description of the function appears. You can specify a description for your custom function in two ways: Either use the Macro dialog box or write VBA code.

Note If you don't provide a description for your custom function, the Insert Function dialog box displays the following text: No help available.

DESCRIBING YOUR FUNCTION IN THE MACRO DIALOG BOX

Follow these steps to provide a description for a custom function:

1. Create your function in the VBE.

2. Activate Excel, making sure that the workbook that contains the function is the active workbook.

3. Choose Developer Code Macros (or press Alt+F8).

The Macro dialog box lists available procedures, but your functions will not be in the list.

4. Type the name of your function in the Macro Name box.

5. Click the Options button to display the Macro Options dialog box.

6. Enter the function description in the Description box (see Figure 10-9). The Shortcut Key field is irrelevant for functions.

Macro Options

Macro name:

remm/eviOYvels

Shortcut Joey;

CW+ Description:

Returns the argument, with ail vowels removed.

Cancel

Figure 10-9: Provide a function description in the Macro Options dialog box.

7. Click OK and then click Cancel.

After you perform the preceding steps, the Insert Function dialog box displays the description that you entered in Step 6 when the function is selected.

CROSS- For information on creating a custom help topic accessible from the Insert

REFERENCE Function dialog box, refer to Chapter 24.

When you use the Insert Function dialog box to enter a function, the Function Arguments dialog box is displayed after you click OK. For built-in functions, the Function Arguments dialog box displays a description for each of the function's arguments. Unfortunately, you cannot provide such descriptions for custom function arguments.

DESCRIBING YOUR FUNCTION WITH VBA CODE

Another way to provide a description for a custom function is to write VBA code. The following statement assigns a description for the function named Commission:

Application.MacroOptions _

Description := "Calculates sales commissions"

You need to execute this statement only one time (not each time the workbook is opened).

0 0

Post a comment