warning message before i leave a sheet

Copper Contributor

I want excel to give a prompt message whenever i am leaving a sheet in a workbook, like "Did you update Cell A4"

2 Replies

@akagarwal_ca 

In Excel, you can set up a warning message to prompt you when leaving a sheet in a workbook by using a macro (VBA code). You can customize the message to ask about specific cells or actions you want to be reminded of before leaving the sheet. But whether this is actually from the VBA code, you would have to know more about the file (file extension, formatting, VBA code, etc.) and the environment (such as Excel version, operating system, storage medium, etc.).

 

If you want to stop the warning message from appearing when leaving a sheet in Excel, you can do so by either:

  1. Disabling Macros: If the warning message is generated by a VBA macro, you can disable

macros in Excel. Here is how:

    • Go to the "File" tab.
    • Click on "Options."
    • In the Excel Options window, select "Trust Center" on the left.
    • Click the "Trust Center Settings" button.
    • In the Trust Center, select "Macro Settings."
    • Choose the option "Disable all macros without notification" to disable all macros in your Excel workbook. This will prevent any VBA code, including the warning message, from running.
  1. Remove the VBA Code: If the warning message is generated by a specific VBA macro in your workbook, you can remove the macro code. Here's how:
    • Press ALT + F11 to open the Visual Basic for Applications (VBA) editor.
    • In the VBA editor, navigate to the workbook or sheet module where the code is located.
    • Remove or comment out the specific code that generates the warning message.
    • Save your workbook.

Please note that option 1 will disable all macros in your Excel workbook, so if you have other macros that you want to keep, you may want to use option 2 to specifically remove the code that generates the message. The text was created with the help of AI.

 

My answers are voluntary and without guarantee!

 

Hope this will help you.

 

Was the answer useful? Mark as best response and like it!

This will help all forum participants.

@akagarwal_ca 

Private Sub Worksheet_Deactivate()
    MsgBox ("Did you update Cell A4")
End Sub

You can apply this code. In this example the code is in table14 (Tabelle14 in the screenshot).

worksheet deactivate.png