How to pass non-contiguous Excel cells to a parameter in UDF

Jan 24, 2013 at 8:22 PM

Like built-in function SUM, you can pass in numbers, cell references contiguous or non-contiguous such as SUM(I1,J2, H6),  I wonder is it possible that my UDF takes a parameter like this,

MyUDF(param1, param2, ....)

I'd like param1 take "string1,string2" or A1:A2 or A1,H2

Is it possible and how


thanks a lot!


Feb 2, 2013 at 3:26 PM
Two ways:
  1. Pass it in in parentheses so the function receives a union range
    myudf( (A1:A2,H1,K4) )
  2. Use ParamArray()