A For and a While loop is used to repeat an action a number of times,
changing the object being acted upon, or until a set number of actions has
been performed.
For instance, you could select a range of cells in Excel, then this code
For each cell in Selection
cell.Interior.ColorIndex = 3
Next cell
will set the cell colour of each cell to 3.
You can also use an index counter in a loop, like so
For i = 1 To Selection.Rows.Count Step 2
Selection.Cells(i, 1).Interior.ColorIndex = 3
Next i
colours very other row of the first column.
While loops are similar, where you test while a condition is true, but are
not used as much.
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)