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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -