View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Continuing a loop from within an if statement?

try

If InStr(Cells(ActiveCell.Row, ActiveCell.Column), "USA") Then MsgBox "Hi"
or for str1

If InStr(str1, "USA") Then dosomething

NO neeed for
else
do something else
end if
IF on same line or you used the continuation character _

--
Don Guillett
SalesAid Software

"Sam" wrote in message
oups.com...
I need to go to the next iteration of my loop from within my IF
statement. How is this done? I can't belive I can't find such a simple
thing on my own...
For i = 1 To lastrow
...do something
If Mid(str1, 1, 3) = "USA" Then
... do something else
Next ///// gives me compile error "next without for"
End If
..do something
Next