module won't quit as expected

S

Sabosis

Hello-

I have the following code in a module so that on holidays, when there
is no data in the file, the code will see "b2" as a blank and kill the
code and exit excel. This works in other macrosI have, but this
particular macro will throw up an error message. Whether I hit End or
Debug, Excel will then shut down as planned. If I manually step
through the code, it works fine. Is there some sort of delay I need to
write into the code so that it has more time to trigger this event?

Thanks-

Scott

If Range("b2").Value = "" Then
Application.DisplayAlerts = False
Application.Quit
End If
 

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