Microsoft Office Tutorials and References
In Depth Information
Using the Insert Function Dialog Box
Figure 23-5: Executing a VBA statement that assigns a function to a particular function category.
Alternatively, you can create a Sub procedure and then execute the procedure.
Application.MacroOptions Macro:=”REMOVESPACES”, Category:=7
After you’ve executed the procedure, you can delete it. A function can be assigned to only one
category. The last category assignment replaces the previous category assignment (if any).
You will, of course, substitute the actual name of your function, and you can specify a different
function category. The AssignToFunctionCategory procedure can contain any number of
statements — one for each of your functions.
Table 23-1 lists the function category numbers that you can use. Notice that a few of these
categories (10–13) normally don’t display in the Insert Function dialog box. If you assign your function
to one of these categories, the category then appears.
You can also create custom function categories. The statement that follows creates a new function
category named My VBA Functions, and assigns the REMOVESPACES function to this category:
Application.MacroOptions Macro:=”REMOVESPACES”, Category:=”My VBA Functions”