Explain about FLEXIBLE Loops
Do Loops - Flexible Loops
Do Loops - Condition Execution After Loop
Testing Loop Determinant - before execution of Body
Do Until Loop - Example
Private Sub CommandButton1_Click()
Dim i As Integer
i = 1
Do Until Range("A" & i).Value = 55
Range("A" & i).Interior.ColorIndex = 3
i = i + 1
Loop
End Sub
Do Until Loop - Example
Private Sub CommandButton1_Click()
Dim i As Integer
i = 1
Do While Range("A" & i).Value <> 55
Range("A" & i).Interior.ColorIndex = 3
i = i + 1
Loop
End Sub
Testing Loop Determinant - After execution of Body
Exit For Loop: Print Numbers
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 1 To 10
Cells(i, 1) = i
If Cells(i, 1) = 5 Then
Exit For
End If
Next
End Sub