ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   module won't quit as expected (https://www.excelbanter.com/excel-programming/429138-module-wont-quit-expected.html)

Sabosis

module won't quit as expected
 
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

JLGWhiz[_2_]

module won't quit as expected
 
You have to cloce any open workbooks.


"Sabosis" wrote in message
...
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




JLGWhiz[_2_]

module won't quit as expected
 
It is not necessary to post multiple times. See your original post.


"Sabosis" wrote in message
...
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




JLGWhiz[_2_]

module won't quit as expected
 
Disregard the multiple post message.


"JLGWhiz" wrote in message
...
It is not necessary to post multiple times. See your original post.


"Sabosis" wrote in message
...
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







All times are GMT +1. The time now is 09:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com