logo
search
VBA & Macro Problems

How to Show a Conditional Excel Pop-Up Message on Workbook Open

Maira MehtabMaira Mehtab Sep 27, 2026 869 views

Question details

The user wants to display a customized congratulatory pop-up message using VBA when an Excel workbook opens, provided specific conditions like today's date and a "DONE" status are met in certain columns.

Product
Excel
Device & OS
not provided
Scenario
Opening a daily tracking workbook where specific targets are marked as DONE, triggering a notification message for those specific tasks upon login.
Observed behavior
The message needs to trigger exactly once when the workbook opens, rather than repeatedly throughout the day when worksheet calculations occur.
Before you start

Ensure your workbook is saved as an Excel Macro-Enabled Workbook (.xlsm) and that you have enabled macros in your spreadsheet security settings.

Solution 1Recommended

Use the Workbook_Open Event in the ThisWorkbook Module

Utilize the Workbook_Open event in VBA to run your condition checks exactly once when the file is opened.

By placing your macro code in the 'ThisWorkbook' module rather than a standard module, Excel knows to execute it automatically upon opening the file.

The script will loop through your rows to check if the date column matches today's date and the status column reads 'DONE', and then trigger a MsgBox with the name from the corresponding row.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) Editor.

2
Access the ThisWorkbook Module

In the Project Explorer pane on the left side, double-click on 'ThisWorkbook' under your specific project.

3
Create the Open Event

Select 'Workbook' from the left dropdown menu above the code window, and 'Open' from the right dropdown. This will generate the Private Sub Workbook_Open() event.

4
Write the Condition Logic

Inside the sub, write a loop that checks your target columns (e.g., Columns B and C). Use an If statement to verify if the date cell equals Date and the status cell equals "DONE".

5
Display the Message Box

If the conditions are met, use the MsgBox function with vbOKOnly to display your congratulations message, referencing the name cell in the same row.

6
Save and Test

Save your file as a Macro-Enabled Workbook (.xlsm), close it, and reopen it to test that the pop-up appears only once.

Avoid Repeated Pop-ups: Triggering this via Workbook_Open instead of a Worksheet_Change event ensures the user is only greeted with the message upon opening the file, preventing workflow interruptions during the day.
Advanced Spreadsheets with WPS Office

Create VBA Macros Easily in WPS Spreadsheet

WPS Spreadsheet fully supports VBA and Macros, allowing you to automate repetitive tasks and set up conditional pop-ups exactly as you would in Microsoft Excel. It is lightweight, highly compatible, and perfect for advanced data management.

  1. 1. Install WPS Office: Download and install WPS Office on your computer.
  2. 2. Open your Workbook: Launch WPS Spreadsheet and open your .xlsm file.
  3. 3. Access the VBA Editor: Navigate to the 'Developer' tab and click on 'Visual Basic' to open the VBA Editor.
  4. 4. Insert the Code: Double-click 'ThisWorkbook', paste your Workbook_Open macro code, and save the file to enable the automated pop-up.
Full support for VBA and Macro executionSeamless compatibility with Microsoft Excel .xlsm and .xlsb filesLightweight application that opens large workbooks quicklyFree to use basic features with an intuitive, tabbed interface
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my Workbook_Open macro triggering when I open the file?

This usually happens because macros are disabled in your security settings, or the file was saved as a standard .xlsx instead of a Macro-Enabled Workbook (.xlsm). Ensure you click 'Enable Content' or 'Enable Macros' when prompted upon opening.

How can I check multiple rows and show one combined message instead of multiple pop-ups?

Instead of calling MsgBox inside the loop, append each matching name to a string variable during the loop. After the loop finishes, check if the string is not empty, and display a single MsgBox containing the combined string.

Can I show a pop-up based on a cell value without using VBA?

No, native automatic pop-up message boxes upon opening a file require VBA. However, you can use Data Validation to show an input message when a specific cell is clicked, or use Conditional Formatting to visually highlight the row without triggering a pop-up.