Loops+Quick+Reference

Execute a group of statements a certain number of times:

Dim i As Integer For i = 1 To 10 MsgBox("Hi") Next

Use a specific sequence of numbers with statements:

Dim i As Integer For i = 2 To 8 Step 2 Textbox1.Text = TextBox1.Text & i Next

Exit a For Loop Prematurely

Dim InpName As String Dim i As Integer For i = 1 To 10 InpName = InputBox("Name?") If InpName = "Trotsky" Then Exit For Textbox1.Text = InpName Next

Execute until a certain condition is met:

Dim Query As String = "" Do While Query <>"Yes" Query = InputBox("Trotsky") If Query="Yes" Then MsgBox("Hi") Loop

Loop Until Certain Condition is True

Dim GiveIn As String Do GiveIn=InputBox(") Loop Until GiveIn="Uncle"