VBA For.. Next.. Loop Equivalent of "Continue For"

Papa_Don

New Member
Joined
Jan 22, 2015
Messages
38
Group,

I have a very simple For/Next Loop that simply says:

For rowNo = 2 To 2000
Go do some stuff
Next rowNo

However I need to insert a "Goto the next iteration of this loop" in a IF statement. However I'm struggling to find the correct syntax to make this happen. Can you help?

I need to say:

For rowNo = 2 To 2000
Go do some stuff
If rmRev = 0
Continue For ' Go to the next iteration of the For Loop
End If
Next rowNo

Can you tell me the correct syntax to do this?

Thanks for your help.

Don
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi Don

try this

Code:
For rowNo= 2 to 2000
    if rmRev = 0 then
        Go do some stuff
            else
               Go do something else
           end if
  next rowNo


Greg
 
Upvote 0
Try reversing the logic of your if.
Instead of saying 'Don't do this or that if rmRev=0
Do it like "do this or that if rmRev DOES NOT = 0

Code:
For rowNo = 2 To 2000
    If rmRev <> 0
         Go do some stuff
    End If
Next rowNo
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top