ReDim string in loop
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
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Arne Hegefors" wrote in message
...
I am redimming an array in a loop. I do not know in before hand how many
times the loop will run. the array must have the siame size as the number
of
iterations in the loop. My problem is that I ReDim the array using the
number
of iterations as upper boundary. However I get the error message "index
outside of interval". I do not understand how this can happen. Perhaps
someone can help me? Any help is appeciated! Thanks very much in advance!
Do Until IsEmpty(rngSecID.Offset(r, lngTypeColumn))
ReDim strMaturityArray(0 To r)
If rngSecID.Offset(r, lngTypeColumn).Text = strGovBond Then
strMaturityArray(r) = Mid(rngSecID.Offset(r, 0), InStr(InStr(1,
rngSecID.Offset(r, 0), " ") + 1, rngSecID.Offset(r, 0), " ") + 1, 4)
MsgBox strMaturityArray(r)
End If
r = r + 1
Loop
|