#1   Report Post  
Posted to microsoft.public.excel.misc
Ollie
 
Posts: n/a
Default Message Box

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ryan Jones
 
Posts: n/a
Default Message Box

You will need to go msgbox("MyfirstMacro", vbyesno)

"Ollie" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.misc
Ollie
 
Posts: n/a
Default Message Box

Thanks Ryan. works well
Much appreciated

"Ryan Jones" wrote:

You will need to go msgbox("MyfirstMacro", vbyesno)

"Ollie" wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.misc
Ryan Jones
 
Posts: n/a
Default Message Box

Sorry
this works

Sub yesno()
MsgBox "hello", vbYesNo
End Sub

"Ollie" wrote in message
...
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



  #5   Report Post  
Posted to microsoft.public.excel.misc
Ollie
 
Posts: n/a
Default Message Box

Thanks Again Ryan

"Ryan Jones" wrote:

Sorry
this works

Sub yesno()
MsgBox "hello", vbYesNo
End Sub

"Ollie" wrote in message
...
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






  #6   Report Post  
Posted to microsoft.public.excel.misc
Paul B
 
Posts: n/a
Default Message Box

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

"Ollie" wrote in message
...
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



  #7   Report Post  
Posted to microsoft.public.excel.misc
Ollie
 
Posts: n/a
Default Message Box

Have created the Macro with success

Thank You very much

"Paul B" wrote:

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

"Ollie" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I control where the input message appears? Bernina27 Excel Discussion (Misc queries) 2 September 16th 05 03:04 AM
Adding an error message at close of file when criteria are met Dave Excel Discussion (Misc queries) 3 August 12th 05 07:56 PM
Calculations And Order In Macros Carl Bowman Excel Discussion (Misc queries) 4 February 23rd 05 10:53 PM
when opening excel I receive a message that says file can't be fo. Ken Excel Discussion (Misc queries) 3 February 22nd 05 12:13 AM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM


All times are GMT +1. The time now is 07:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"