VBA – Yes No Message Box (Msgbox)

Associated Files Download Links

Yes No Message Box in VBA

YesNoMessageBoxHere is code to present the user with a Yes/No Message box and have the ability to run code based on the response.

It works by setting a variable equal to the message box response and evaluating the variable with an IF…THEN statement.

The code is commented in locations for changing the message text displayed, where to place code for a Yes response, and No response.

To retrieve a user inputted string, see my post about the InputBox.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

VBA Yes No Message Box Builder

Learn More!

<<Return to VBA Examples

Did you find this VBA tutorial useful? Then share it with your friends and colleagues:

You may also like some of this related content...

VBA allows you to choose a file to open using the Application.GetOpenFilename method. In this
VBA InputBox The VBA InputBox allows you to prompt the user to input information.  That
Make Userform Transparent Tek-Tips has a nice post in their forums for making User Forms
Line Break in a Message Box (msgbox) If you need to put a larger amount