excel - Can a VBA custom function knows that the formula is entered as an array formula? -


is possible make following function returns either multiple values or single value according how user enters formula?

public function test(byval flnumber double) variant   dim flresult1 double   dim sresult2 string   dim barrayformula boolean    flresult1 = round(flnumber / 10 ^ 6, 1)   sresult2 = "million"    ' how know formula entered array formula?   if barrayformula     test = array(flresult1, sresult2)   else     test = flresult1 & " " & sresult2   end if end function 

just examine application.caller

public function smartfunction() string     addy = application.caller.address     if range(addy).hasarray         smartfunction = "array formula"     else         smartfunction = "normal formula"     end if end function 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -