Creating User Defined Functions

Excel provides many built-in formulas, but there are times when you need a complex custom formula not offered—for example, a formula that sums a range of cells based on their interior color.

So, what do you do? You could go down your list and copy the colored cells to another section. Or, perhaps you have a calculator next to you as you work your way down your list—beware you don't enter the same number twice! Both methods are time consuming and open to accidents. What to do? You could write a procedure—after all, that's what this book is about. But, there is another option: User-Defined Functions (UDFs).

You can create functions in VBA that can be used just like Excel's built-in functions, such as SUM. After the custom function is created, a user needs to know only the function name and its arguments.

0 0

Post a comment