Run a macro if a certain value is entered in a cell
You can use a worksheet event ...
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a1")) Is Nothing Then Exit Sub
If Target.Value = "" Then Exit Sub
MsgBox "You just changed: " & Target.Address(0, 0) & vbLf & _
". Now don't forget to..."
End Sub
Right click on the worksheet tab that should have this behavior. Select view
code and paste this into the code window that just opened.
Change A1 to the address of the cell you want to check.
nickystan wrote:
Hi,
I want to have it so that on a column if a certain value is entered in any
of the cells then a message is displayed to tell them to do something else.
I want to be able to run a macro if the value is entered.
--
Dave Peterson
|