View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Zack Barresse[_3_] Zack Barresse[_3_] is offline
external usenet poster
 
Posts: 101
Default Pass function as argument to UDF

Hi,

Not sure I *fully* understand what you're asking, but you pass arguments
just as you would any other procedure/method in VBA ..

=MyUDF("string1",A1,SUBSTITUTE(A1," ",""))

Just remember to name your arguments/variables in the code of your function

Function MyUDF(arg1 as String, arg2 as Range, arg3 as Variant)
'...
End Function

Not sure if you want to change the types to Variants to consider multiple
sources, but as I'm not sure of the entire scope of your UDF, it's hard to
say.

HTH

--
Regards,
Zack Barresse, aka firefytr, (GT = TFS FF Zack)
To email, remove the NO SPAM. Please keep correspondence to the board, as
to benefit others.


"Ron Rosenfeld" wrote in message
...
How would I pass a function as an argument to a UDF?

For example:

=MyUDF(arg1, arg2, arg3)

where arg1 might be a literal text string, a reference to a cell
containing a
string, OR a formula that returns a string:

SUBSTITUTE(A1,old_text,new_text)

I want to manipulate the resultant string in my UDF.

Thanks.
--ron