For Statement
Syntax
For Num = First To Last [Step Inc] statements Next [Num]
Group
Description
Executes statements while Num is in the range First to Last.
Parameters
| Parameters | Description |
|---|---|
| Num | The iteration variable. |
| First | Sets Num to this value initially. |
| Last | Continues looping while Num is in the range. See Step below. |
| Step | If this numeric value is greater than zero, the for loop continues as long as Num is less than or equal to Last. If this numeric value is less than zero, the for loop continues as long as Num is greater than or equal to Last. If this is omitted, one is used. |
Example
Sub Main For I = 1 To 2000 Step 100 Debug.Print I; I+I; I*I Next I End Sub
See also