VBA two dimensional array within function - size not known in advance
Posted on 2010-11-12
I am writing a user defined function that will process two strings. I need a two dimesional array with one dimension equalling the length of the first string and the other equalling the length of the second string. The string lengths are not known in advance.
As ReDim is confined to the last dimension of an array, I don't think I can use it.
Is there a simple way to set up an array precisely sized for the function on each call or do I need to declare a fixed array bigger than the largest strings I expect to handle?
I've made use of dictionaries for other aspects of the module but this part really needs to be set up as a 2D array akin to a mathematical matrix. The contents of the array are type Single variables and the function returns a type Single value.
This seesm to be a matter of widespread interest but I haven't found a way around it in an extensive search.