Understanding VBA Function Basics

A VBA function is a procedure that's stored in a VBA module. You can use these functions in other VBA procedures or in your worksheet formulas.

A module can contain any number of functions. You can use a custom function in a formula just as if it were a built-in function. If the function is defined in a different workbook, however, you must precede the function name with the workbook name. For example, assume you developed a function called DiscountPrice (which takes one argument), and the function is stored in a workbook named PRICING.XLS.

To use this function in the PRICING.XLS workbook, enter a formula such as this:

0 0

Post a comment