Custom function to return output in multiple cells

  • Thread starter Thread starter Asif
  • Start date Start date
A

Asif

I'd like to write a function that returns more than one value, which I'd
like to be displayed in multiple cells. Is it possible? If not, what's the
nearest thing I can do?
 
Public Function ArrList(rng as Range)
Dim varr as Variant
Dim i as long
varr = rng.Value
for i = lbound(varr,1) to ubound(varr,1)
varr(i,1) = varr(i,1)*i
Next
ArrList = varr
End Function

select cells C1:C10

in the formula bar enter:

=ArrList(C1:C10)
end with Ctrl+Shift+Enter rather than just enter to array enter the formula.
 

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

Back
Top