Provides Professional Knowledge about Password/Data Recovery and Product Key

How to Add or Delete Pop-up Message Box to Excel Cell

If you want to add any description for any cell you select in Excel, pop-up message box is undoubtedly a good choice. With VBA code, you could easily create or delete pop-up message box to excel cell.

Add or Remove Pop-up Message Box to Excel Cell Using VBA Code

Step 1: Open worksheet with cells that you need to display message box when you click it.

Step 2: Right click the sheet tab and select View Code from the context menu.

right click view code to open VBA window

Step 3: Confirm sheet you choose in appearing Microsoft Visual Basic for Applications window.

Step 4: Copy and paste following VBA code in the right blank code window.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range(“A1:C10”)) Is Nothing Then _
        MsgBox “Please input a number”, vbInformation, “Kutools for Excel”
End Sub

add message box to excel cell using VBA code

Notes:

  1. In the code, “A1:C10” means that message box will pop up when click on any cell of this range.
  2.  “Please input a number or name” is displayed content of the message box.

If you want to change the content in pop-up message box, please enter that you want to display.

Step 3: Press Alt + Q to close the Microsoft Visual Basic for Applications window.

From now on, when clicking on any cell of range A1:C10, you will get a message box as below screenshot shown.

successfully pop up message box on clicked cell

And if you want to remove the message box, just need to select the sheet tab to view its VBA code, and delete the code. Then there would be no pop-up message box to excel cell.

 

Related Articles:

 

Comments are currently closed.