I need a VBA If Else statement within a For Next loop
I have tried various arrangements of the statements, but they all error out.
Sub TestForIfElse()
This will work:
Sub TestForIfElse() Dim Counter As Integer Dim i As Integer For i = 1 To 5 Counter = i If Counter > 3 Then Exit For End If Next i End Sub