I've got a VBA UDF which extracts (multiple) numbers from a string, cell, range, or array. It's used in a variety of scenarios so it needs that flexibility, and generally worked EXCEPT...when the range has different result sizes in different cells
The function returns a single number, array of results, or array of array of results (if a range/array input). I think the issue is excel doesn't handle returning a jagged array and it is trying to convert it to a 2d array and falling over at the different subarray lengths. Is there a way around this other than normalising to a 2d?
I've attached a watch showing the output variable in the function (dummy line as breakpoint added directly before the end function line). It works, but fails on the spreadsheet side. If the sub arrays are the same size it works. This is one of a set of very similar functions I'm developing - but with the same mechanism.
The function returns a single number, array of results, or array of array of results (if a range/array input). I think the issue is excel doesn't handle returning a jagged array and it is trying to convert it to a 2d array and falling over at the different subarray lengths. Is there a way around this other than normalising to a 2d?
I've attached a watch showing the output variable in the function (dummy line as breakpoint added directly before the end function line). It works, but fails on the spreadsheet side. If the sub arrays are the same size it works. This is one of a set of very similar functions I'm developing - but with the same mechanism.