Dynamic multi-dimensional array
No, sorry. I didn't state my original question well. I need an easy way to
change the number of dimensions of an array based on the changing value of
the number of dimensions and elements.
Here's the long way to do it:
numberOfdimensions = n
d(0) = 5
d(1) = 6
d(2) = 10
select case numberOfdimensions:
case 1:
redim arr(d(0))
case 2:
redim arr(d(0), d(1))
case 3:
redim arr(d(0), d(1), d(2))
etc. etc
end select
***
I'm looking for a simpler way. The following won't work, but is there a
similar way to do this:
for ddx = 0 to 2
s = s & d(ddx) & ", " ' s will end up = "5, 6, 10"
next ddx
redim arr(s)
Thanks again.
"Ryan H" wrote:
Is this what you are wanting? Hope this helps! If so, let me know, click
"YES" below.
dim arr()
dim s as string
s = "5, 6, 10"
arr = Split(s, ",")
--
Cheers,
Ryan
"DSH" wrote:
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.
|