MsgBox working is Excel Macro Programming

V

Vikas Vadgama

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.
 
A

Alan McQuaid via OfficeKB.com

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
 
J

Jacob Skaria

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
 
Top