excel - VBA to save array of data to a given column of the spreadsheet -


i have function in vba calculates moving average, like:

function calculatemovingaverage(mydate date, mydatevector range, myprices range, mywindow integer)  ' use series of prices calculate moving average on number of days  ' i.e. if mywindow=50 calculate 50 days moving average  calculatemovingaverage = movingavg  end function 

the function saves results in array having, let's say, 1000 elements. how can make code save array cell a1 cell a1000?

via .transpose:

range("a1:a1000").value = application.transpose(movingavg) 

(dynamically: range("a1:a" & ubound(movingavg) + 1)...)


Comments