Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am trying to add a message box into a macro that will provide Yes / No
option. "Yes " to continue macro and "No" to end macro. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
One way:
Dim nResult As Long nResult = Msgbox(Prompt:="Continue?", Buttons:=vbYesNo) If nResult = vbYes Then 'Your code here End If Or, if you don't mind having multiple exit points to your macro: Dim nResult As Long nResult = Msgbox(Prompt:="Continue?", Buttons:=vbYesNo) If nResult = vbNo then Exit Sub 'Your code here In article , Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dim Resp as long
...... Resp = msgbox(Prompt:="Want to continue?", buttons:=vbyesno) if resp = vbno then exit sub end if ..... Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Ron,
If you won't be testing the yes/no response anywhere else, then you can shorten the code to: If MsgBox("Continue?", vbYesNo, "Please answer this short question.") = vbYes Then ' Yes code goes here MsgBox "Yes" Else ' No code goes here End End If -- Earl Kiosterud www.smokeylake.com Note: Top-posting has been the norm here. Some folks prefer bottom-posting. But if you bottom-post to a reply that's already top-posted, the thread gets messy. When in Rome... ----------------------------------------------------------------------- "Ron (Bismark)" wrote in message ... I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you your info has helped me and saved me heaps of time. I had been
trying to achieve this for last two days. Very much appreciated. "JE McGimpsey" wrote: One way: Dim nResult As Long nResult = Msgbox(Prompt:="Continue?", Buttons:=vbYesNo) If nResult = vbYes Then 'Your code here End If Or, if you don't mind having multiple exit points to your macro: Dim nResult As Long nResult = Msgbox(Prompt:="Continue?", Buttons:=vbYesNo) If nResult = vbNo then Exit Sub 'Your code here In article , Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
From the 3 replies I received yours was the one that was simplest for me to
follow and have used it. thankyou very much. I would like to rate your response but can not see how I do this. Top Marks from me. "Dave Peterson" wrote: Dim Resp as long ...... Resp = msgbox(Prompt:="Want to continue?", buttons:=vbyesno) if resp = vbno then exit sub end if ..... Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thankyou for your response. You have given me an additional option which will
help me on another project. Your quick response is very much apptreciated. "Earl Kiosterud" wrote: Ron, If you won't be testing the yes/no response anywhere else, then you can shorten the code to: If MsgBox("Continue?", vbYesNo, "Please answer this short question.") = vbYes Then ' Yes code goes here MsgBox "Yes" Else ' No code goes here End End If -- Earl Kiosterud www.smokeylake.com Note: Top-posting has been the norm here. Some folks prefer bottom-posting. But if you bottom-post to a reply that's already top-posted, the thread gets messy. When in Rome... ----------------------------------------------------------------------- "Ron (Bismark)" wrote in message ... I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
In a couple of hours/days/weeks..., you'll be able to look back and read each
response and see that they're pretty much equivalent. It never hurts me (too much) to revisit things when I get a little smarter <bg. Ron (Bismark) wrote: From the 3 replies I received yours was the one that was simplest for me to follow and have used it. thankyou very much. I would like to rate your response but can not see how I do this. Top Marks from me. "Dave Peterson" wrote: Dim Resp as long ...... Resp = msgbox(Prompt:="Want to continue?", buttons:=vbyesno) if resp = vbno then exit sub end if ..... Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. -- Dave Peterson -- Dave Peterson |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dave, What does this <bg tag mean?
"Dave Peterson" wrote: In a couple of hours/days/weeks..., you'll be able to look back and read each response and see that they're pretty much equivalent. It never hurts me (too much) to revisit things when I get a little smarter <bg. Ron (Bismark) wrote: From the 3 replies I received yours was the one that was simplest for me to follow and have used it. thankyou very much. I would like to rate your response but can not see how I do this. Top Marks from me. "Dave Peterson" wrote: Dim Resp as long ...... Resp = msgbox(Prompt:="Want to continue?", buttons:=vbyesno) if resp = vbno then exit sub end if ..... Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. -- Dave Peterson -- Dave Peterson |
#10
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Big Grin.
Kind of like a smiley face in email messages. Tevuna wrote: Dave, What does this <bg tag mean? "Dave Peterson" wrote: In a couple of hours/days/weeks..., you'll be able to look back and read each response and see that they're pretty much equivalent. It never hurts me (too much) to revisit things when I get a little smarter <bg. Ron (Bismark) wrote: From the 3 replies I received yours was the one that was simplest for me to follow and have used it. thankyou very much. I would like to rate your response but can not see how I do this. Top Marks from me. "Dave Peterson" wrote: Dim Resp as long ...... Resp = msgbox(Prompt:="Want to continue?", buttons:=vbyesno) if resp = vbno then exit sub end if ..... Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. -- Dave Peterson -- Dave Peterson -- Dave Peterson |
#11
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
<bg"Learned something tonight"</bg
"Tevuna" wrote: Dave, What does this <bg tag mean? "Dave Peterson" wrote: In a couple of hours/days/weeks..., you'll be able to look back and read each response and see that they're pretty much equivalent. It never hurts me (too much) to revisit things when I get a little smarter <bg. Ron (Bismark) wrote: From the 3 replies I received yours was the one that was simplest for me to follow and have used it. thankyou very much. I would like to rate your response but can not see how I do this. Top Marks from me. "Dave Peterson" wrote: Dim Resp as long ...... Resp = msgbox(Prompt:="Want to continue?", buttons:=vbyesno) if resp = vbno then exit sub end if ..... Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. -- Dave Peterson -- Dave Peterson |
#12
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I don't speak the HTML <vbg.
http://www.acronymfinder.com Tevuna wrote: <bg"Learned something tonight"</bg "Tevuna" wrote: Dave, What does this <bg tag mean? "Dave Peterson" wrote: In a couple of hours/days/weeks..., you'll be able to look back and read each response and see that they're pretty much equivalent. It never hurts me (too much) to revisit things when I get a little smarter <bg. Ron (Bismark) wrote: From the 3 replies I received yours was the one that was simplest for me to follow and have used it. thankyou very much. I would like to rate your response but can not see how I do this. Top Marks from me. "Dave Peterson" wrote: Dim Resp as long ...... Resp = msgbox(Prompt:="Want to continue?", buttons:=vbyesno) if resp = vbno then exit sub end if ..... Ron (Bismark) wrote: I am trying to add a message box into a macro that will provide Yes / No option. "Yes " to continue macro and "No" to end macro. -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pop up message | Excel Worksheet Functions | |||
Message Box "Value" | Excel Discussion (Misc queries) | |||
Message Box | Excel Discussion (Misc queries) | |||
Add a Message Box | Excel Worksheet Functions | |||
changing the message in an error message | Excel Worksheet Functions |