PDA

View Full Version : Solved: For Next loop inside a If statement



austenr
03-24-2010, 03:33 PM
Does this look like it will work?

If [condition true]
for i = 1 to 30
do something
next i
end if

mdmackillop
03-24-2010, 03:55 PM
You're missing a "Then"

A simple test


Sub test()
If True Then
For i = 1 To 30
msg = msg & i & vbCr
Next i
End If
MsgBox msg
End Sub

Bob Phillips
03-24-2010, 04:41 PM
Logically, yes. But why do you ask? I sense there is a deeper question lurking underneath that innocuous one :).

austenr
03-24-2010, 05:48 PM
Thanks but I got it.

Aussiebear
03-24-2010, 07:48 PM
Aren't they all Bob?