View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Dynamic multi-dimensional array

I think the only way you will be able to do what you want is this way...

Dim arr(), Temp() As String
Dim s As String
s = "5, 6, 10"
Temp = Split(s, ",")
Select Case UBound(Temp)
Case 0 ' One dimensional array
ReDim arr(Temp(0))
Case 1 ' Two dimensional array
ReDim arr(Temp(0), Temp(1))
Case 2 ' Three dimensional array
ReDim arr(Temp(0), Temp(1), Temp(2))
Case <<etc. ' Keep this structure going depending on the maximum needed
......
End Select

--
Rick (MVP - Excel)


"DSH" wrote in message
...
Is it possible to create a dynamic multi-dimensional array? I know the
following will not work, but something to the effect:

dim arr()

dim s as string

s = "5, 6, 10"

redim arr(s) 'i.e. redim arr(5, 6, 10)

Thanks.