Specifying a function category

Oddly, Excel does not provide a direct way to assign a custom function to a category. If you would like your custom function to appear in a function category other than User Defined, you need to do so by writing and executing some VBA code.

The following statement assigns the function named Commission to the Financial category (category number 1):

Application.MacroOptions Macro:="Commission", Category:=1

You only need to execute this statement one time (not each time the workbook is opened). From then on, every time the workbook is opened, the function will appear in the category that you specified.

Table 10-1 lists the category numbers that you can use. Notice that a few of these categories (10 through 13) are normally not displayed in the Insert Function dialog box. If you assign your function to one of these categories, the category will appear in the dialog box.

Table 10-1 FUNCTION CATEGORIES

Category Number

10 11 12

Category Name

All (no specific category)

Financial

Date & Time

Math & Trig

Statistical

Lookup & Reference

Database

Text

Logical

Information

Commands

Customizing

Macro Control

DDE/External

User Defined

Engineering

0 0

Post a comment