|
Home > Macros > Basics > Messages Show Messages With Excel MacrosShow warning messages in Excel workbook. Give automatic alerts, data entry tips. See steps in short videos, written steps. Get sample files with VBA code. Tip: For non-macro ways to show a message in Excel, you can add a comment to a cell, or use a data validation input message. |

With a macro, you can show a message to people using an Excel workbook, to give helpful information or a warning.
Watch this video to see the steps for setting up an Excel message macro, and there are written steps below the video
To create macros for some actions in Excel, you can use the built-in macro recorder.
Unfortunately, you can’t record all the steps for creating a message, but you can use the Record Macro button to get started.
Even though you didn't record any actions, Excel created a macro for you. To see the macro code, follow these steps:
The Excel Visual Basic Editor (VBE) opens, and you can see the macro. There are Sub and End Sub lines, and one comment line

You can’t record the code that shows the message box, so you’ll have to type it.
Msgbox "Select a Customer Name"
To see warning message that you created, switch back to Excel
The message will appear in the centre of the Excel window.

That simple macro shows a message box, and the user will have to click the OK button before they can continue working in Excel.
That will be a helpful reminder, but you can edit the message box, to give it more impact.
Follow the steps below, to add a "Critical" icon to the message box. That might encourage people to take the message seriously!

Test your macro again, to see the Critical icon in the revised message box.

In the next section, you'll see how to revise the macro again, so it only runs if the customer name in cell B5 is missing.
In the section after that, you'll see how make the macro run automatically, if someone tries to print the worksheet, without a customer name selected
With a macro, you can show a message automatically, when something happens in Excel, to give information or a warning.
Watch this video to see the steps, and see the written instructions here: Show a Message Automatically
In this macro, a message shows automatically when someone tries to print the worksheet.
Watch this video to see the steps, and see the written instructions here: Show a Message Before Printing
In this macro, a personalized message includes a name.

Watch this video to see the steps, and see the written instructions here: Show Personalized Excel Message Box.
In this macro, if you try to print the worksheet's order form, with no customer name entered, a message box appears.
The message asks if you want to "Print without Customer Name?"

Watch this video to see the steps, and see the written instructions on my Contextures Blog: Collect Data From Users in Excel VBA.
NOTE: The sample file is available in the Download section, below.
Last updated: April 1, 2025 12:02 PM