Populate a range of cells from a function
4eyed wrote:
I'm trying to write a function that will populate the cell that called
the function and x number of cells below it. For example
in cell A1, i make a call to my function "=GetList()"
GetList should put the numbers 1 - 10 in cells a1 - a10
its driving me crazy
David Chen's response should have been that with a function called from
a worksheet you cannot change the contents of cells *other than those
into which the function is entered*.
Array enter into A1:A10 =GetList()
Function GetList()
Dim arr
N = 10
ReDim arr(1 To N, 1 To 1)
For i = 1 To N
arr(i, 1) = i
Next
GetList = arr
End Function
Alan Beban
|