Yes or No MsgBox in VBA Macro

Grimm127

Board Regular
Joined
Aug 17, 2011
Messages
132
Hi all you wonderful Guru's,

I have a Macro with several calls within. How do I place a message box in before the last call to either yes run the last call or no to end the macro right there?

Call Macro1
Call Macro2
pop up a msg box yes or no to either continue to the next call or end the macro
Call Macro3

Thanks in advance
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi

How about something like:

Dim answer as string

Call Macro1
Call Macro2
Answer=(msgbox "Run macro 3?" ,vbyesno)

If answer=vbyes then
call macro 3
end if
 
Upvote 0
How about
VBA Code:
Call Macro1
Call Macro2
If MsgBox("do you want to continue?", vbYesNo) = vbNo Then Exit Sub
Call Macro3
 
Upvote 0
Hi

How about something like:

Dim answer as string

Call Macro1
Call Macro2
Answer=msgbox( "Run macro 3?" ,vbyesno)

If answer=vbyes then
call macro 3
end if


Don't know how to edit a post but my bracket was in the wrong place!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,720
Members
448,986
Latest member
andreguerra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top