ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Exit a macro from an error condition (https://www.excelbanter.com/excel-programming/288387-exit-macro-error-condition.html)

ChuckM[_2_]

Exit a macro from an error condition
 
Is there a way to exit a program during it's execution. I want to
check if a condition is met...if not, then exit the program.
thanks
chuckm

Chip Pearson

Exit a macro from an error condition
 
Chuck,


You can use the Exit Sub statement to exit the current procedure.
E.g.,

If whatever = False Then
Exit Sub
End If



"ChuckM" wrote in message
...
Is there a way to exit a program during it's execution. I

want to
check if a condition is met...if not, then exit the program.
thanks
chuckm




John Wilson

Exit a macro from an error condition
 
Chuck,

Sure can....
What condition are you checking for??

If range("A1") = "abc" Then Exit Sub

John

"ChuckM" wrote in message
...
Is there a way to exit a program during it's execution. I want to
check if a condition is met...if not, then exit the program.
thanks
chuckm





All times are GMT +1. The time now is 03:06 AM.

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