Showing posts with label Loop Counter. Show all posts
Showing posts with label Loop Counter. Show all posts

Wednesday, October 27, 2010

The For loop

The For loop is used when the number of repetitions is known. It uses a single variable to start the loop, and indicates how many times the loop needs to execute.

For intCount = 0 To 5
   msgbox("This is loop number " & intCount)

Next


The loop counter variable in this instance is intCount. It begins at 0. Each pass of the loop causes the loop counter to increment +1. The loop will execute 6 time - from 0 to 6.