message box pop up for a given value in a cell

  • Thread starter Thread starter The Grinch
  • Start date Start date
T

The Grinch

Hi All,

I want a message box to automatically appear if a given value i
entered in a cell. If I was writing a macro, I could do somethin
like...

If Range("a1").Value = "given value" Then
MsgBox ("my message")
End If

but I want the message box to appear automatically, ie without havin
to run a macro.

CHEERS for any hel
 
hi

got this from http://support.microsoft.com/default.aspx?
scid=kb;en-us;213612&Product=xl2002

Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range

' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("A1:C10") <you may modify the
range>

If Not Application.Intersect(KeyCells, Range
(Target.Address)) _
Is Nothing Then

' Display a message when one of the designated
cells has been
' changed.
' Place your code here.
'<Insert your validation here>
MsgBox "Cell " & Target.Address & " has changed."

End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top