VBA Example of Using WHILE and LOOP?
On Oct 13, 11:35*am, Mike wrote:
On Oct 13, 11:15*am, "joeu2004" wrote:
"Mike" wrote:
Can someone please refer me to an example on how
to use WHILE and LOOP in Excel's VBA?
In VBA Help, type "while wend statement" and "do loop statement" without
quotes, and you will get lots of information. *A few simple examples.....
x = 1
While x <= y
* * [...some statements...]
* * x = x + 1
Wend
x = 1
Do While x <= y
* * [...some statements...]
* * x = x + 1
Loop
x = 1
Do Until x y
* * [...some statements...]
* * x = x + 1
Loop
x = 1
Do
* * [...some statements...]
* * x = x + 1
Loop While x <= y
x = 1
Do
* * [...some statements...]
Loop Until x y
The first 3 are equivalent to:
For x = 1 to y
* * [...some statements...]
Next
What if you have two or more conditions instaed of one?- Hide quoted text -
- Show quoted text -
My WHILE/LOOP structure is as follows:
WHILE condition1 and condition2
LOOP over t while condition3 as below:
WHILE( PlnHrznTop <= ts
AND Continue < 0),
LOOP( t while (ORD(t) = PlnHrznTop),
|