Vba Programming Basics

You can create VBA functions that you can use within Excel directly to create formulas. When you create a public function in the Visual Basic Editor, it appears in the Insert Function dialog box that displays when you click Insert O Function within Excel. The VBE places the functions that you create under the User Defined category on the Insert Function dialog box. You can use these VBA functions directly in your worksheet to create formulas in the same fashion that you use the built-in functions that come standard with Excel. Keep in mind that the VBA functions you create are available only on the Insert Function dialog box when the corresponding workbook containing the function is open within Excel. Therefore, if you create a specific function that you want to use with all your workbooks, you must add the function to the Personal Macro Workbook, Personal.xls, to ensure that it is always available from within Excel. The Personal Macro Workbook always opens with Excel, so any macros and functions it contains are always available. See Chapter 1 for more information on the Personal Macro Workbook.

| File Edit View Insert Format Debug Run Tools Add-Ins Window Help

I a-B »a B 44 1*1 t II i H S i" S )f m I u. 1, ool SB

^ VBAProject 'UffnufcHi

¡ Microsott Visual Basic - OfficeEnpenses.xls

File Edit View Insert Format Debug Run Tools Add-Ins Window Help

□ Type the data type to be returned by the function.

0 In parentheses, type the names of the function parameters.

□ Type the data type to be returned by the function.

0 0

Post a comment