Create array function

  • Thread starter Yuriy Kuznetsov
  • Start date
Y

Yuriy Kuznetsov

How to create worksheet function that return a array into
cells ? This function return only 100 into cells (i put cell as single
or as a arry function (with ctrl+shift+enter)

Function test() As Variant
Dim a(2) As Byte
a(0) = 100
a(1) = 50
test = a
End Function
 
T

Tom Ogilvy

It works for me.

Select C4:E4, go to the formula bar and enter
=Test()
then exit with Ctrl+Shift+Enter

The 3 cells must be in a single row.

If displays 100 50 0

note that A(2) produces a 3 element array, same as Dim A(0 to 2)
 
Y

Yuriy Kuznetsov

10x Tom:)
My mistake... I my situation I put in column not into row:(
Into column situation right usage is {=TRANSPOSE(test())}
Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top