This macro will display a message box in excel when a cell reaches a certain value or contains certain text. This means that when cell A1 contains the value "hi" a message box will pop-up telling the user that cell A1 now contains the word "hi".
This macro can be changed to display a message box whenever a cell meets whatever criteria you want. You can change the criteria to display a message whenever certain text is entered into a cell by changing ,in this line of code, If rng = "hi" Then the "hi" to whatever you want. You can also change the display message to whatever you would like by changing the text inbetween the quotation marks in this code MsgBox "Cell " & _ rng.Address & " = hi". Also, if you want to change the cell to which the value must be entered for a message box to appear, change the A1 in this line of code to whatever you would like Set rng = Range("A1").
This macro is particularly useful in forms in excel. This way you can solicit input from a user and when he/she enters something, you can have a message box appear to remind them of something or to warn the user etc. This is pretty versatile code and is easily modified to check for many different types of values or characters and to then display the pop-up message box in excel.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rng As Range
Set rng = Range("A1")
If Not Intersect(Target, rng) Is Nothing Then
If rng = "hi" Then
MsgBox "Cell " & _
rng.Address & " = hi"
End If
End If
Set rng = Nothing
End Sub