ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On Error STOP!!! (https://www.excelbanter.com/excel-programming/343302-error-stop.html)

Vikxcel[_2_]

On Error STOP!!!
 

Ok, so I searched and I need your help again guys.
How do I stop on Error? just quit, maybe drop a msgbox in there with
reason, but just stop right after it, don't do anything in the code???

Thank you all for your help.

So:
On Error ????
MsgBox "Command Terminated"
....

--
Vikxce
-----------------------------------------------------------------------
Vikxcel's Profile: http://www.excelforum.com/member.php...fo&userid=1860
View this thread: http://www.excelforum.com/showthread.php?threadid=47771


Bob Phillips[_6_]

On Error STOP!!!
 
Use Stop

On Error Goto quit_it
'code


quit_it:
Stop

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Vikxcel" wrote in
message ...

Ok, so I searched and I need your help again guys.
How do I stop on Error? just quit, maybe drop a msgbox in there with a
reason, but just stop right after it, don't do anything in the code???

Thank you all for your help.

So:
On Error ????
MsgBox "Command Terminated"
...?


--
Vikxcel
------------------------------------------------------------------------
Vikxcel's Profile:

http://www.excelforum.com/member.php...o&userid=18607
View this thread: http://www.excelforum.com/showthread...hreadid=477714




Mike Fogleman

On Error STOP!!!
 
From VBA help:
End Statement Example
This example uses the End Statement to end code execution if the user enters
an invalid password.

Sub Form_Load
Dim Password, Pword
PassWord = "Swordfish"
Pword = InputBox("Type in your password")
If Pword < PassWord Then
MsgBox "Sorry, incorrect password"
End
End If
End Sub
Stop Statement Suspends execution.SyntaxStopRemarksYou can place Stop
statements anywhere in procedures to suspend execution. Using the Stop
statement is similar to setting a breakpoint in the code.The Stop statement
suspends execution, but unlike End, it doesn't close any files or clear
variables, unless it is in a compiled executable (.exe) file.Mike F

"Bob Phillips" wrote in message
...
Use Stop

On Error Goto quit_it
'code


quit_it:
Stop

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Vikxcel" wrote in
message ...

Ok, so I searched and I need your help again guys.
How do I stop on Error? just quit, maybe drop a msgbox in there with a
reason, but just stop right after it, don't do anything in the code???

Thank you all for your help.

So:
On Error ????
MsgBox "Command Terminated"
...?


--
Vikxcel
------------------------------------------------------------------------
Vikxcel's Profile:

http://www.excelforum.com/member.php...o&userid=18607
View this thread:
http://www.excelforum.com/showthread...hreadid=477714







All times are GMT +1. The time now is 12:04 AM.

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