How to Add a Yes No Pop-up Message Box to a Macro Before it Runs (Part 4 of 4)

Excel Campus - Jon
Excel Campus - Jon
126.5 هزار بار بازدید - 8 سال پیش - Sign up for our Excel
Sign up for our Excel webinar, times added weekly: https://www.excelcampus.com/blueprint...

Learn how to make a Yes No Message Box (pop-up window) appear before the macro code runs.  This is critical if you have custom macro buttons on the ribbon or anywhere in your workbook.  

If the user accidentally presses a macro button then the code will run and could potentially ruin the workbook or cause irreversible damage.

The Yes No Message Box is easy to implement in any macro and only requires four lines of code.

Read the article and download the Excel file here:
http://www.excelcampus.com/vba/person...

In this video I explain exactly how to create this code and how to use the msgbox function in VBA.

The msgbox function is basically a line of code that creates a pop-up window with buttons on it.  This means you do NOT need to create a userform.  The function has parameters that allow you to choose what the buttons will say.  It could be Yes/No, Ok/Cancel, Ok Only, Warning icon, or many other options.  This is a great VBA skill to learn and add to any macro.

Other videos in this series:
How to Create a Personal Macro Workbook in Excel and Why You Need It (Part 1 of 4):
How to Create a Personal Macro Workbo...

Where Is The Personal Macro Workbook Stored and How to View It (Part 2 of 4):
Where Is The Personal Macro Workbook ...

How to Add Macro Buttons to the Excel Ribbon or Quick Access Toolbar (Part 3 of 4):
How to Add Macro Buttons to the Excel...

Please leave a comment below with any questions, and don't forget to hit the LIKE button if you enjoyed this video.  Thank you!!!
00:00 Introduction
00:21 What is a Yes No Message Box
01:21 VBA Editor
01:48 Macro Code
02:20 Message Box Variable
04:48 If Statement
06:50 Running the Macro
08:40 Conclusion
8 سال پیش در تاریخ 1395/01/05 منتشر شده است.
126,597 بـار بازدید شده
... بیشتر