Array functions gets called multiple times

352 views
Skip to first unread message

grendo

unread,
Apr 3, 2011, 3:46:50 AM4/3/11
to Excel-DNA
Hi,
I have an UDF that returns an array, (using the evaluate() statement
on a string like "{col1,col2,col3;1,2,3}". When I select 3 rows and
3 columns, enter my function, hit ctrl+shift+enter the array function
gets called the first time where the reference has the first and last
columns/rows correctly set, (eg 1 and 3), then gets called multiple
times where the reference has the first and last columns always set to
the first cell in the range. Strangely enough when I write the
function in vba and debug I do not see this behaviour.

eg

Public Function TestArray() As Variant
getarr = Evaluate("{""amount"",""name"";1,2}")
End Function

Also note that my function when written in ExcelDna is wrapping up a
RTD which I would not expect to cause an issue.

Is this expected behaviour ?

Govert van Drimmelen

unread,
Apr 3, 2011, 4:07:33 AM4/3/11
to Excel-DNA
Hi,

A functions that wrap an RTD call, entered as an array formula, will
be called by Excel for every array element. This was discussed here:
http://groups.google.com/group/exceldna/browse_thread/thread/03b3155508c8ce81.

This behaviour has nothing to do with Excel-DNA, and happens even with
a plain RTD server and a VBA wrapper function.

-Govert
Reply all
Reply to author
Forward
0 new messages