ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VbYesNo Msg Box (https://www.excelbanter.com/excel-discussion-misc-queries/46605-vbyesno-msg-box.html)

mjack003

VbYesNo Msg Box
 

Howdy,

I've connected a macro to a command button but before executing I need
a Yes/No msgbox to appear. How would I go about creating a msgbox that
if "yes" execute, if "no" End sub? Any help is appreciated.

Best Regard,
Mjack


--
mjack003
------------------------------------------------------------------------
mjack003's Profile: http://www.excelforum.com/member.php...fo&userid=5141
View this thread: http://www.excelforum.com/showthread...hreadid=469749


Dave Peterson

option explicit
sub testme01()
dim Resp as long
resp = msgbox(Prompt:="Continue?",buttons:=vbyesno)
if resp = vbno then
'msgbox "Quitter!"
exit sub
end if

'rest of code here
end sub



mjack003 wrote:

Howdy,

I've connected a macro to a command button but before executing I need
a Yes/No msgbox to appear. How would I go about creating a msgbox that
if "yes" execute, if "no" End sub? Any help is appreciated.

Best Regard,
Mjack

--
mjack003
------------------------------------------------------------------------
mjack003's Profile: http://www.excelforum.com/member.php...fo&userid=5141
View this thread: http://www.excelforum.com/showthread...hreadid=469749


--

Dave Peterson


All times are GMT +1. The time now is 10:56 PM.

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