For...Next

For <var> = <start> To <stop> [Step <stepval>]
...
Next

A simple loop with predefined conditions.

Parameters

varVariable used for counting.
startThe initial value of the variable.
stopThe final value of the variable.
stepvalOptional. The step by which the value of the variable changes. May be negative. The default step is 1.

Example

For var = 1 To 4
  MsgBox(var) # --> 1 --> 2 --> 3 --> 4
Next
 
For var = 5 To 2 Step -1
  MsgBox(var) # --> 5 --> 4 --> 3 --> 2
Next

Related

While...Wend, Break, Continue