For

Loop - repeat a block of statements a specific number of times.

Syntax
      For CounterVariable = StartNum To EndNum [STEP StepNum]
        [Exit For]
      Next [CounterVariable]

If not specified the default step is 1.
To decrease the counter variable use a negative STEP value.
To exit a For...Next statement before the counter reaches its end value use the EXIT FOR statement.

Examples

For x = 1 to 100
  Total = Total + x
Next

MsgBox "The total is " & Total

“Winning takes talent; to repeat takes character.” ~ John Wooden

Related

If Then Else - If-Then-Else
Case - If Then Else


 
Copyright © 1999-2024 SS64.com
Some rights reserved