11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

622<br />

Part VI: Developing Custom Worksheet Functions<br />

Figure 23-5: Executing a VBA statement that assigns a function to a particular function category.<br />

Alternatively, you can create a Sub procedure and then execute the procedure.<br />

Sub AssignToFunctionCategory()<br />

Application.MacroOptions Macro:=”REMOVESPACES”, Category:=7<br />

End Sub<br />

After you’ve executed the procedure, you can delete it. A function can be assigned to only one<br />

category. The last category assignment replaces the previous category assignment (if any).<br />

You will, of course, substitute the actual name of your function, and you can specify a different<br />

function category. The AssignToFunctionCategory procedure can contain any number of<br />

statements — one for each of your functions.<br />

Table 23-1 lists the function category numbers that you can use. Notice that a few of these categories<br />

(10–13) normally don’t display in the Insert Function dialog box. If you assign your function<br />

to one of these categories, the category then appears.<br />

You can also create custom function categories. The statement that follows creates a new function<br />

category named My VBA Functions, and assigns the REMOVESPACES function to this category:<br />

Application.MacroOptions Macro:=”REMOVESPACES”, Category:=”My VBA Functions”

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!