Interested to become VBA Pro? Here is 100% free guided e-course with Real-life projects. Sign-up to participate, get assignments and a certificate:- Sing up link = > bit.ly/3eX8tzl
simply update arg(0) to arg(1) if 2 arguments, arg(2) if 3 arguments arg(0) = "first argument desc." arg(1) = "2nd argument desc." arg(2) = "3rd argument desc." and so on
@@VBAA2ZThank you so much. i have another question and didnt find any answer. how can i define a optional argument for a function so that if i leave it empty the function does not give #value error. like "FV" or "Type" arguments in PV function which as you can see their fonts are not bold like other arguments and they could be left empty.
I use the keyword Optional for this problem. The syntax is e.g.: Function my_func(a1 As Range, Optional a2 As Double = 1, Optional a3 As Single = 2) a2 and a3 are optional and when not specified become 1 for a2 and 2 for a3. If you don't want to specify default values and handle missing arguments situation in another way you can write: Function my_func(a1 As Range, Optional a2 As Double, Optional a3 As Single) and check if a2 or a3 is missing by the IsMissing(argument) function.
Interested to become VBA Pro? Here is 100% free guided e-course with Real-life projects.
Sign-up to participate, get assignments and a certificate:-
Sing up link = > bit.ly/3eX8tzl
Very useful. I have no idea we could add description or argument info using VBA.
you're welcome, thanks for watching.
thanks for the knowledge transfer.
you're welcome, thanks for watching.
Is it possible to call back a user defined function like these on a custom ribbon control?
Like other built in excel formulas.
yes you can. try like this and let me know if have any questions.
th-cam.com/video/IYXzMvKO51M/w-d-xo.html
my function has 4 arguments. how can i add all of 4 argument descriptions. yours only have one. thanks
simply update arg(0)
to arg(1) if 2 arguments, arg(2) if 3 arguments
arg(0) = "first argument desc."
arg(1) = "2nd argument desc."
arg(2) = "3rd argument desc."
and so on
@@VBAA2ZThank you so much. i have another question and didnt find any answer. how can i define a optional argument for a function so that if i leave it empty the function does not give #value error. like "FV" or "Type" arguments in PV function which as you can see their fonts are not bold like other arguments and they could be left empty.
that needs to be handled within your code using if x = "" or if x is nothing etc...
I use the keyword Optional for this problem. The syntax is e.g.:
Function my_func(a1 As Range, Optional a2 As Double = 1, Optional a3 As Single = 2)
a2 and a3 are optional and when not specified become 1 for a2 and 2 for a3.
If you don't want to specify default values and handle missing arguments situation in another way you can write:
Function my_func(a1 As Range, Optional a2 As Double, Optional a3 As Single)
and check if a2 or a3 is missing by the IsMissing(argument) function.
This was interesting but the Application.MacroOptions doesn't actually change anything about my Function
Is it possible to create UDF Argument Custom options? Eg. VLOOKUP shows TRUE or FALSE for the last argument [range_lookup]
Check this out th-cam.com/video/z3cbAh7CzMo/w-d-xo.html
@@VBAA2Z Thanks very much!