ReDim string in loop
Yeah, makes sense, but Sod's law will say that one time you don't dim it big
enough.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Alan Beban" <unavailable wrote in message
...
Bob Phillips wrote:
Where is the Redim statement Arne? I would have expected to see it
within
the loop, something like
Do Until ...
Redim Preserver ary (r)
ary(r) = some_value
r=r+1
Loop
I think it's probably much more efficient to ReDim Preserve once at the
end, a la
Dim ary()
reDim ary(n)
Do Until . . .
ary(r) = some_value
r=r+1
Loop
ReDim Preserve ary(r-1)
where n is a number big enough to accommodate all possible iterations,
rather than ReDim Preserve in each iteration of the loop.
Alan Beban
|