How to pop up message box if cell value changes within a range in Excel?
Sometimes you need to remind yourself of the changes within a range in a certain worksheet. So a pop up message box will do you a favor if cell value has changed in a certain range. You can achieve it with a VBA method in this article.
The following VBA code will pop up a message box if cell value changes within a specified range of a certain worksheet. Please do as follows.
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 the sheet name (the specified range exists in) in the left bar to open its Code window, then copy and paste the below VBA code into the window.
VBA code: pop up message box if cell value changes within a range
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Application.Intersect(Range("A1:E19"), Target) Is Nothing) Then
MsgBox "Cell " & Target.Address & " has changed.", vbInformation, "Kutools for Excel"
Note: you can change the specified range A1:E19 in the code to the range you need.
3. Press Alt + Q keys at the same time to close the Microsoft Visual Basic for Applications window.
For now on, when cell values in range A1:E19 changed, a message box will pop up automatically. See screenshot:
The Best Office Productivity Tools
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
More than 300 powerful features. Supports Office/Excel
2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features
30-day free trial. 60-day money back guarantee.
Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ExitSub
Dim One As Long Dim Two As Long
One = Range("A1").Value Two = Range("B1").Value
If Not (Application.Intersect(Range("A1:B1"), Target) Is Nothing) Then If (One > Two) Then
MsgBox "Range(""A1"") > Range(""B1"")", vbInformation, "Kutools for Excel" End If