+ Reply to Thread
Results 1 to 5 of 5

For type loop verse Do type loop

  1. #1
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562

    For type loop verse Do type loop

    I have been a member of this list for less than a month, but I have noticed in several posts that several seem to favor a For type loop over the Do type loop. Most of my programs are used to perform a variety of procedures on big lists of students so I am normally using Do While Len(student id) <> 0.

    Would a For type loop be a better option in my given situation? Is there any particular advantage to using a For loop as opposed to a Do loop?

    Thanks for the input!

    Jeff

  2. #2
    Registered User
    Join Date
    02-09-2006
    Posts
    51
    Hello Jeff, I probably am not the best one to answer this but: A FOR loop is set on the amount of times that you want it to run, where as a DO loop is looking for a condition to be met.

    Hope it helps

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Have a look at my last reply in

    http://www.excelforum.com/showthread...=591910&page=2

    In the same thread see my earlier message for an example of how I structure For loops
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Jeff

    i have just added another reply to the other thread

  5. #5
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    mudraker,

    Thanks for the additional response concerning For and Do type loops. Checking memory as opposed to a cell value would be quicker so I can see how a For loop might make my sub run a little faster than the Do loop.

    I also got the message concerning posting back to the thread instead of using the PM feature. I will do that in the future!

    Thanks for all the help!

    Jeff

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1