"On Error Exit Do" is compile error??

E

Ed

I created a Do Loop, then made my first statement after Do to be "On Error
Exit Do". But it highlights in red and gives me a compile error: "Expected:
GoTo or Resume". What did I do wrong? How do I do it right?

Ed
 
J

Jonathan West

Ed said:
I created a Do Loop, then made my first statement after Do to be "On Error
Exit Do". But it highlights in red and gives me a compile error:
"Expected:
GoTo or Resume". What did I do wrong? How do I do it right?

Hi Ed,

The only forms that the On Error command can follow are as follows

On Error Resume
On Error Resume Next
On Error Goto label

where label is the name of a label elsewere in the routine

You need to do something like this

Do While SomeCondition
On Error Goto dropout
'your code goes here
Loop
dropout:
'more code follows here
 
E

Ed

Thank you. I had remembered seeing the "Exit" (For, Do If) statements used,
but didn't quite remember how. I will do something else then. I appreciate
the help.

Ed
 

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