vba - Excel UDF with ParamArray constraint like SUMIFS -
i trying code excel udf similar syntax builtin sumifs
, signature like
function myudf(param1 type1, paramarray paramrest() variant) mytype
but condition paramarray must have even number of elements (ideally typed). @ possible?
for example if try enter =sumifs(a:a,b:b,1,c:c)
cell, excel complain using wrong number of arguments (because paramarray array(range("b:b"),1,range("c:c"))
, have odd number of elements). want same behaviour myudf
.
currently handle after fact:
if ubound(paramrest) mod 2 <> 1 myudf = cverr(xlerrvalue) exit function end if
but feels "dirty".
Comments
Post a Comment