ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MsgBox working is Excel Macro Programming (https://www.excelbanter.com/excel-programming/432420-msgbox-working-excel-macro-programming.html)

Vikas Vadgama

MsgBox working is Excel Macro Programming
 
I want a MsgBox when the macro starts with 2 buttons. If user presses OK
button, macro continues. If user presses Cancel button, macro ends. Can
someone please advise how to do the same.
--
Vikas Vadgama
Though worth Millions: Humanity is the biggest & the best religion. Live &
Let Live.

Alan McQuaid via OfficeKB.com

MsgBox working is Excel Macro Programming
 
Hi,

You could use the below

Message = MsgBox("Do you want to continue?", vbOKCancel, "Continue?")
If Message = vbCancel Then End
''' If OK is selected code will run through

Alan

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200908/1


Jacob Skaria

MsgBox working is Excel Macro Programming
 
Sub Macro()
If MsgBox("Do you want to continue?", vbOKCancel) < vbYes Then Exit Sub
'your code continues

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Vikas Vadgama" wrote:

I want a MsgBox when the macro starts with 2 buttons. If user presses OK
button, macro continues. If user presses Cancel button, macro ends. Can
someone please advise how to do the same.
--
Vikas Vadgama
Though worth Millions: Humanity is the biggest & the best religion. Live &
Let Live.



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

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