ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   MsgBox when an Error occurs (https://www.excelbanter.com/excel-discussion-misc-queries/61474-msgbox-when-error-occurs.html)

Vick

MsgBox when an Error occurs
 
Is there a way that I can have a message box display when an error is
received while running a Macro?

Vick

Bob Phillips

MsgBox when an Error occurs
 
You need to trap the error and display the message. Example

Sub Test()
On Error Goto errHandler
'more code
Exit Sub

errHandler:
Msgbox "some message"
End Sub

--

HTH

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


"Vick" wrote in message
...
Is there a way that I can have a message box display when an error is
received while running a Macro?

Vick





All times are GMT +1. The time now is 06:48 PM.

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