|
Back to: Excel VBA . Got any Excel/VBA Questions? Free Excel Help SEE ALSO: Add UDF to Custom Category via VBA
There are at least 2 ways you can use to add a description to you UDF's, one is relatively well known, while the other is a simple but little known method. Lets use the better known method first.
Open up the VBE (Alt+F11) and select anywhere within your Function code. Now Push F2 to open the "Object Browser". At the top of the Object Browser there are 2 drop down boxes. Click the top one and select "VBAProject". You should now have all Modules and global Objects showing in the "Classes" box situated at the bottom of the Object Browser. Click on the name of the Module that houses your UDF. In the "Members of..." box to the right you should see the names of all Functions and Procedures within the selected Module. Simply right click on the name of your UDF and select "Properties". Type a description for your UDF, then click Ok and then Save.
Now here is the little known method. This is best done before you write your UDF.
- Go to Tools>Macro>Record new macro.
- In the Description box, type a description for your UDF. Type the name of your UDF and click Ok.
- Now Stop recording.
- Open the VBE (Alt+F11) and replace the word "Sub" with "Function"
- Add your Function arguments as normal.
How to add your UDF to a category
Another common question is, how to add your UDF to a certain category
in the "Paste Function" dialog. By default all UDF's are added to the "User
Defined" category. Here is how you can change this.
Simply run some code like this:
Application.MacroOptions Macro:="MyCustomFunction", _ Category:=3'Add to Math & Trig
The category numbers are as shown below:
0 No category appears only in All
1 Financial
2 Date & Time
3 Math & Trig
4 Statistical
5 Lookup & Reference
6 Database
7 Text
8 Logical
9 Information
10 Commands normally hidden
11 Customizing normally hidden
12 Macro Control normally hidden
13 DDE/External normally hidden
14 User Defined default
15 Engineering only available if the Analysis Toolpak add-in is installed
How to add a new category
By default when you write a Custom function (UDF) it is added to the User Defined by default. Although not well known, we can easily create our own category(s) to keep all our Custom functions in, here's how
Microsoft Excel will add the new category to the list for you. Once you have added at least one custom function to the new category (it will be probably be # 16), you can delete the "MyFunction" (or whatever name you used) name we typed in step 3. The new category will remain. If you delete the Microsoft Excel 4.0 macro sheet, functions already assigned to the custom category remain in that category; however, you cannot assign a new function to that category after you delete the macro sheet.
SEE ALSO: Add UDF to Custom Category via VBA
Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money
Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to [email protected] 31 days after purchase date.
Instant Download and Money Back Guarantee on Most Software
Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!
Microsoft � and Microsoft Excel � are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft
Some of our more popular products are below...
Convert Excel Spreadsheets To Webpages | Trading In Excel | Construction Estimators | Finance Templates & Add-ins Bundle | Code-VBA | Smart-VBA | Print-VBA | Excel Data Manipulation & Analysis | Convert MS Office Applications To...... | Analyzer Excel | Downloader Excel
| MSSQL Migration
Toolkit |
Monte Carlo Add-in |
Excel
Costing Templates