Results 1 to 3 of 3

Thread: [RESOLVED] loop from upper bound to lower bound

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2008
    Posts
    327

    Resolved [RESOLVED] loop from upper bound to lower bound

    hi all,
    i remember when i first started to learn vb i came across a task that had to loop from upper bound to lower bound.. but now, i fail to recall it..i did google and search but i can't get what i am looking for.. heres a simple example
    vb Code:
    1. dim i as integer
    2. dim spl() as string
    3. dim strA as string
    4. stra="a/b/c/e/f"
    5. spl=split(stra,"/")
    6. for i = ubound(spl) to lbound(spl)
    7. debug.print spl(i)(
    8. next i

    ..i want to loop form the upper bound to lower bound..obtaining the result f,e,c,b,a ..

    ..i can use other ways to get it.. but my question is .. 'is there any syntax that allows to loop from ubound to lbound' ,if yes please provide the correct syntax.?

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: loop from upper bound to lower bound

    Code:
    For i = UBound(spl) To LBound(spl) Step -1
        Debug.Print spl(i)
    Next i

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2008
    Posts
    327

    Re: loop from upper bound to lower bound

    thank you edgemeal..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width