For Next Loop

Also known as · Loops

Repeats a block of VBA code while a counter changes: For i = 2 To 4 ... Next i runs three times with i taking the values 2, 3 and 4.

When to use

In the BMI macro the loop fills three people's rows, because Cells(i, column) writes one row lower on each pass. Combine it with Cells(row, col) when the position is calculated.

See Lec 08.

Appears in

No references yet.