View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default VBA Example of Using WHILE and LOOP?

PS....

"Mike" wrote:
LOOP over t while condition3 as below:
WHILE( PlnHrznTop <= ts
AND Continue < 0),
LOOP( t while (ORD(t) = PlnHrznTop),


Two more possible interpretations of your cryptic pseudocode come to mind.
Again, this might be misdirection.

If PlnHrznTop <= ts And Continue < 0 Then
Do
[...some code...]
Loop While ORD(t) = PlnHrznTop And PlnHrznTop <= ts And Continue < 0
End If

--or--

Do While PlnHrznTop <= ts And Continue < 0
Do
[...some code...]
Loop While ORD(t) = PlnHrznTop
Loop

PS: The outer Do While...Loop could be written using While...Wend. I kept
it as Do While to demonstrate that the looping constructs can be nested. I
did not want you to misunderstand that one must be While...Wend if the other
is Do...Loop.

PPS: I tend to use Do While...Loop instead of While...Wend because we can
use Exit Do in the middle. There is no Exit While; we must use Go To. No
biggie; it's just a style thing.