Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default what loop structure???

just a quick question what loop structure would be most appropriate to
use if im checking for a condition at the end of the loop? i dotn no
many other loops if anyone no,s ou there can they show me an example
so i can see how its done

thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default what loop structure???

Loops generally have 2 approaches. The following is from the VBA Help entry
on Do..Loop:

Do [{While | Until} condition]
[statements]
[Exit Do]
[statements]

Loop

Or, you can use this syntax:

Do
[statements]
[Exit Do]
[statements]

Loop [{While | Until} condition]

The primary difference between the 2 is that statements within the 1st
method will only be executed if the condition statement is initially True.

In the 2nd method, statements within the loop will always be executed at
least ONCE. After that, the condition has to be true for the loop to repeat.

So, its not really a question of what's best to test for a condition at the
end of the loop, either method will effectively do that. It's really a
question of what do you want to happen when the loop is first encountered.

HTH,


"paul" wrote in message
ups.com...
just a quick question what loop structure would be most appropriate to
use if im checking for a condition at the end of the loop? i dotn no
many other loops if anyone no,s ou there can they show me an example
so i can see how its done

thanks



Reply
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
Formula structure Excel Erick Excel Worksheet Functions 3 December 25th 08 10:16 AM
array structure [email protected] Excel Programming 2 June 30th 07 05:12 AM
Need loop structure to get round limited IF statements karambos Excel Discussion (Misc queries) 5 August 30th 05 12:31 AM
if structure help filo666 Excel Programming 4 March 1st 05 08:37 PM
Structure of If...Else in VBA John Wilson Excel Programming 2 July 30th 03 04:33 AM


All times are GMT +1. The time now is 08:36 PM.

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

About Us

"It's about Microsoft Excel"