newbie: stop a FOR NEXT loop

M

Mike H

how can I jump out of a for next loop before I get to the top of the series
of numbers?
 
F

Frank Isaacs

Check out Exit in the online help; it's used for this situation (Exit For)
as well as others (Exit Do, Exit Sub, Exit Function, etc.).
--
HTH -

-Frank Isaacs
Dolphin Technology Corp.
http://vbapro.com
 
C

Chrissy

Rethink your loop control.

Maybe you should not be using a for next loop - maybe a do while
loop would be better.

Chrissy.
 
T

Tom Ogilvy

for each cell in Range("A1:A200")
if isempty cell then exit for
' code to execute
Next


for i = 1 to 1000
if [test condition] then exit for
' code to execute
Next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top