How to pop up a message box upon activating/opening a specified worksheet in Excel?
You may need a message box pop up to remind you about the details of a worksheet when you activating it in Excel. Please try the below method.
Pop up a message box upon activating a specified worksheet with VBA code
Pop up a message box upon activating a specified worksheet with VBA code
The following VBA code can help you to pop up message box when activating a specified worksheet.
1. Press Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, double click ThisWorkbook in the Project pane to open the ThisWorkbook (Code) window. And then copy and paste the below VBA code into the code window.
VBA code: Pop up message box upon activating a specified worksheet
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
On Error Resume Next
If Sh.Name = "Sheet1" Then
MsgBox "Please remember to fill in the daily sale", vbInformation, "Kutools for Excel"
End If
End Sub
Note: In the code, please replace Sheet1 with your specified sheet name. And replace the message box content “Please remember to fill in the daily sale” with the content you need.
3. Press Alt + Q keys simultaneously to close the Microsoft Visual Basic for Applications window.
From now on, when activating or opening this worksheet, a message box will always pop up as below screenshot shown.
Related articles:
- How to create a message box timer to auto close the message box after certain time in Excel?
- How to pop up message box when clicking on a certain cell in Excel?
- How to copy text from message box in Excel?
- How to pop up message box to display range of cells or cell values in Excel?
- How to pop up message box if cell value changes within a range in Excel?
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!