Assuming range1
and range2
are single cell Range objects which evaluate to an integer/long value, I believe this is your problem:
You have a multi-dimensional array (3 columns, and a varying number of rows to be determined by the maximum of range1
or range2
). The number of rows doesn't really matter. The problem is that you cannot put an array of values in a single cell.
Long story short, you should certainly be able to assign to an array like you are doing, for example:
If your function is returning #Value!
error, then there is some problem with the rest of your function, or with what you are expecting/attempting to do with the function.