A nested loop is a loop within a loop, an inner loop within the body of an outer one. How this works is that the first pass of the outer loop triggers the inner loop, which executes to completion. Then the second pass of the outer loop triggers the inner loop again. This repeats until the outer loop finishes. a break within either the inner or outer loop would interrupt this process.
The Structure of a For Next nested loop is :
For counter1=startNumber to endNumber (Step increment)
For counter2=startNumber to endNumber (Step increment)
One or more VB statements
Next counter2
Next counter1
Example :
For firstCounter = 1 to 5
Print “First Loop of ” + firstCounter
For secondCounter= 1 to 4
Print “Second Loop of ” + secondCounter
Next secondCounter
Next firstCounter