How to add argument description to Macros/User Defined Functions in Excel VBA
User-defined functions are created in Excel for helping the Excel users. It would be good to add descriptions of the arguments used in the functions. This can be done using Application.Macrooptions method
Let us assume a small User Defined Function that takes an argument:
The following code will add the UDF to information category
User-defined functions are created in Excel for helping the Excel users. It would be good to add descriptions of the arguments used in the functions. This can be done using Application.Macrooptions method
Let us assume a small User Defined Function that takes an argument:
Function A_Sample_UDF(ByVal sArg)
MsgBox "Sample UDF " & sArg
End Function
The following code will add the UDF to information category
Sub Add_UDF()
Dim ArgDes As Variant
ArgDes = Array("First Arg")
Application.MacroOptions Macro:="Personal.XLSB!A_Sample_UDF", Description:="Sample Function", Category:="Information", ArgumentDescriptions:=ArgDes
End Sub