SurfsUp123
New Member
- Joined
- May 24, 2021
- Messages
- 3
- Office Version
- 2016
- Platform
- Windows
Hi there,
Can anyone tell me if it is possible to make a function in one cell output to multiple cells, descending vertically.
Here is a simple example where I copy numbers from one column to another, but the for loop just loops it to the bottom of the data set instead of outputting in one cell and then moving down to the next. is it possible to fix this?
Can anyone tell me if it is possible to make a function in one cell output to multiple cells, descending vertically.
Here is a simple example where I copy numbers from one column to another, but the for loop just loops it to the bottom of the data set instead of outputting in one cell and then moving down to the next. is it possible to fix this?
VBA Code:
Function myOne(data)
Dim nrows As Integer
nrows = data.Rows.Count
'defne array
Dim DataArray() As Double
ReDim DataArray(1 To nrows, 1)
'store data into array
For i = 1 To nrows
DataArray(i, 1) = data.Cells(i, 1)
Next i
For i = 1 To nrows
myOne = data.Cells(i, 1)
Next i
End Function