ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msgbox (https://www.excelbanter.com/excel-programming/322437-msgbox.html)

Qaspec

msgbox
 
I'd need to insert an option on my macro where if yes is selected the macro
will keep running. If cancel is selected the macro will stop and no changes
are made.

Chip Pearson

msgbox
 
Try some code like

Dim Res As Long
Res = MsgBox("Do you want to continue?", vbYesNo)
If Res = vbNo Then
Exit Sub
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Qaspec" wrote in message
...
I'd need to insert an option on my macro where if yes is
selected the macro
will keep running. If cancel is selected the macro will stop
and no changes
are made.




sebastienm

msgbox
 
Hi, try:

If vbCancel = MsgBox("Continue process?", vbOKCancel, "Process") Then
MsgBox "Process cancelled"
Exit Sub 'Process cancelled
End If
MsgBox "Process continuing"

Regards,
Sebastien

"Qaspec" wrote:

I'd need to insert an option on my macro where if yes is selected the macro
will keep running. If cancel is selected the macro will stop and no changes
are made.




All times are GMT +1. The time now is 02:36 PM.

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