Cannot use function with optional arguments

G

Guest

I have a function: Public Function fncTest(Optional A, Optional B)

In Source property of Text box I try: =fncTest(B:"xyz")
No good!

I try: =fncTest(A:="abc", B:"xyz")
No good!

I try: =fncTest("abc", "xyz")
Works fine.

Am I doing something wrong?
 
G

Guest

I have a function: Public Function fncTest(Optional A, Optional B)

In Source property of Text box I try: =fncTest(B:="xyz")
No good!

I try: =fncTest(A:="abc", B:="xyz")
No good!

I try: =fncTest("abc", "xyz")
Works fine.

Am I doing something wrong?
 
G

Graham Mandeno

Hi Tom

You can't use named arguments in a calculated expression - only in VBA.
However, you can use commas as place fillers for positional arguments:
=fncTest("abc")
=fncTest(, "def")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top