LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default UBound array problem

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
--
atrep
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array values with UBound [email protected] Excel Programming 1 June 12th 07 10:17 PM
Array Ubound gti_jobert[_71_] Excel Programming 6 March 27th 06 10:34 PM
UBound of multi-dimensional array? Jake Marx[_3_] Excel Programming 0 August 16th 05 06:34 PM
Handling ubound on an uninitialised array Mike NG Excel Programming 14 January 24th 05 09:05 AM


All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"