Message Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a macro that gives me a message box when it is run.
Sub MyMacro()
MsgBox "My First Macro"
When I run it I get a message box that only has 1 option in it "OK"

Is there a way to create one that will give me a "Yes" or "No" message
 
Ollie, here is one way,

Sub Message_box_test()

Msg = "Put message here"
Title = "Put title here"
Response = MsgBox(Msg, vbYesNo+ vbQuestion, Title)

If Response = vbNo Then
'your code if no is clicked here
MsgBox "you clicked no"
Exit Sub ' Quit the macro
End If


'your code if Yes is clicked here
MsgBox "you clicked yes"
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
Back
Top