View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
STEVE BELL STEVE BELL is offline
external usenet poster
 
Posts: 692
Default continue statement in a loop

Sounds like you are looking for an If....Then.....Else....End If
(put in your own conditions)

If Range("A1") = 5 then
' your code to do if 1st condition is true
Elseif y = x then
' your code to do if 2nd condition is true
Else
' your code to do if all condition(s) are false
End If

The For ... Next loop

For i = 0 to 100 step = 1 (do not need step = 1 if you are indexing by 1)
' your code

Next

--
steveB

Remove "AYN" from email to respond
"rozner" wrote in
message ...

Hi,

I found the "continue" statement in VB documentation but I think it was
only for .NET, it doesn't seem to compile with Excel and VBA. Is there a
way to do this?

I have some code in Java I am trying to use in macro. I'm looking for
the Java equivalent of:


Code:
--------------------

for (int i=0; i<someLength; i++) {
// do some stuff

if (condition) {
continue;
}

// more stuff
}

--------------------

I haven't done VB in a while but I was thinking perhaps a goto
statement may work. Any suggestions on this? Thanks a lot


--
rozner
------------------------------------------------------------------------
rozner's Profile:
http://www.excelforum.com/member.php...o&userid=25794
View this thread: http://www.excelforum.com/showthread...hreadid=391982