Sunday, February 01, 2009

How to add a user defined function to a Category using Excel VBA Macro

How to Categorize the User Defined Function using VBA Macro

The following code adds the Get_Net_Working_Days UDF to the Date & Time Category.

Sub Add_UDF_To_Category()

Application.MacroOptions Macro:="PERSONAL.XLSB!Get_Net_Working_Days", Category:=2, Description:="Returns Net Working Days for 2009" '

End Sub

The above snippet uses the MacroOptions function that sets/resets properties that are available in Macro Options dialog

Insert Function Dialog – Before Macro

Insert Function Dialog – After Macro



2 comments:

  1. You can create your categories by supplying a custom string for the Category:= parameter.

    For example: Category:="My UDF's"

    ReplyDelete
  2. See:
    www.jkp-ads.com/articles/registerudf00.asp

    Regards,
    Jan Karel Pieterse
    Excel MVP

    ReplyDelete

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.