I made a function that will convert almost anything to a string, including a multi-dimensional array!
'example1:
Debug.Print fStr(array(1 to 2, 1 to 2)) '>>> (("11","21"),("21","12"))
'example2:
ReDim arr(1 To 2, 1 To 3) As Variant
arr(1, 1) = "11" & Chr(13)
arr(2, 1) = 21
arr(1, 2) = Array(Null, 1)
arr(2, 2) = True
Set arr(1, 3) = ActiveCell
Set arr(2, 3) = Nothing
Debug.Print fStr(arr) '>>> (("11[13]",21),((Null,1),True),(Sheet1!A1,Nothing))
Now I want to reverse it, but I can't find a way to Dim or Redim a multi-dimensional array that could have 1 up to 6000 dimensions!
The amount of "(" at the beginning of the string tells how many dimensions, but I don't want to add 6000 lines with each line having a Redim with one more dimension!
So how can I use a variable as the Redim multi-dimensional parameter ???
So I need to find a solution that looks like this:
d="1 to 2, 1 to 3"
Redim arr(d)
or like this:
fReDim "1 to 2", "1 to 3"
Sub fReDim (ParamArray d() As string)
Redim arr(d())
end Sub
Any help appreciated, thank you.
Oh yeah, for those that are looking for a function that converts anything to a string: Book1.xlsm
Bookmarks