X
xavi garriga
Dears;
I have a problem with a "For", the code is similar to this one:
for x = 1 to UBound(Array())
IF "some conditions" then
Redim Preserve Array(UBound(Arrray())-1)
x = x-1
end if
next x
For example supose the array [10,3].
The conditions make reference to the current array postion
for x = 1 supose the conditions are accomplished and the array would become:
[10]
and x will be x = 0.
Next x is x = 1. Now the conditions are not accomplised, so the array
continues being [10] and next x = 2.
The problem is that for X = 2, goes once more inside the loop but the
UBound of array is 1, so now we are out of range!
How can I solve this?
Thanks to all
I have a problem with a "For", the code is similar to this one:
for x = 1 to UBound(Array())
IF "some conditions" then
Redim Preserve Array(UBound(Arrray())-1)
x = x-1
end if
next x
For example supose the array [10,3].
The conditions make reference to the current array postion
for x = 1 supose the conditions are accomplished and the array would become:
[10]
and x will be x = 0.
Next x is x = 1. Now the conditions are not accomplised, so the array
continues being [10] and next x = 2.
The problem is that for X = 2, goes once more inside the loop but the
UBound of array is 1, so now we are out of range!
How can I solve this?
Thanks to all