By using listi.net you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

listi.net

 


Loops

Loops allow you do run the same code over and over.

Loops have an exit condition otherwise they're infinite loops
  • Do While - Loop
  • For - Next

    To process all rows in a spreadsheet you can use a loop

    r = findlastrow(1)
    for i = 2 to r
    ... do something
    next

    or

    r = findlastrow(1)
    range("A2").select
    Do While Activecell.Row <= r

    ' do something

    activecell.offset(1,0).Select


    Loop

    GetNextRow()




  • blog comments powered by Disqus