I have an function which returns a array. If the size of the array is 5461 rows or less, it works fine. If it is more than that, it gives VALUE! error.
In the latter case it does not cause the execution to be halted if I have Break on all Errors set.
I have not been able to find a reference to a specific Excel limit to the size of arrays returned from functions, but it looks like that's what I'm getting. Can anyone confirm this is the problem? If not, is there a way to avoid it?
If you want to see what I mean, the code below is a simple example showing the problem. If you paste this function into 5461 cells as an array formula, they all get filled w/ random values. If you paste it into 5462 cells, they all get VALUE! error.
Any suggestions gratefully received.
Tony
In the latter case it does not cause the execution to be halted if I have Break on all Errors set.
I have not been able to find a reference to a specific Excel limit to the size of arrays returned from functions, but it looks like that's what I'm getting. Can anyone confirm this is the problem? If not, is there a way to avoid it?
If you want to see what I mean, the code below is a simple example showing the problem. If you paste this function into 5461 cells as an array formula, they all get filled w/ random values. If you paste it into 5462 cells, they all get VALUE! error.
Code:
Public Function dummy() As Variant
Dim i As Long, max As Long
max = Application.Caller.Rows.count
ReDim ary(1 To max, 1 To 1) As Variant
For i = 1 To max
ary(i, 1) = Rnd()
Next i
dummy = ary()
End Function
Any suggestions gratefully received.
Tony