Using a Function Macro
You use functions as part of Excel worksheet formulas or as part of Access expressions that build calculated fields.
In Excel, as with the program's built-in functions, you can either type the function into the formula by hand, or you can use the Insert Function method. Assuming you edit a cell formula, you can enter a VBA function into the formula by hand using the following general format:
WorkbookName.xls!FunctionName(arguments)
Here, WorkbookName is the file name of the workbook that contains the function, FunctionName is the name of the function, and arguments is the list of values for the arguments accepted by the function.
To use the Insert Function method, follow these steps:
- Choose Insert, Function to display the Insert Function dialog box.
- In the Or Select a Category list, click All to make sure that all the VBA functions are included in the Select a Function list.
- The VBA functions display in the list using the same WorkbookName.xls!FunctionName format. Therefore, first look for the workbook name in the listand then select the function you want.
- Click OK.
- If the function accepts arguments, enter them and click OK.