H
Haleigh
Hi all,
I've read http://www.cpearson.com/excel/events.htm to help
me understand how to trigger a macro based on a cell
value, but can't get it to work. I've put the following
code in "Module 1".
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "R32" Then
Application.EnableEvents = False
If Target.Value >37 Then
MsgBox "Total hours cannot be greater than 37!"
End If
Application.EnableEvents = True
End If
End Sub
In English, what I'm asking is, if the value of
(calculated) cell R32 is greater than 37, then display the
message box.
What I don't understand is this - In the Visual Basic
editor window, if I click Run, a dialog comes up asking me
for the name of the macro. The macro Worksheet_Change
doesn't appear. There might be something else wrong, but
since I can't get it to even run, it can't be tested.
Any advice will be deeply appreciated.
Haleigh
I've read http://www.cpearson.com/excel/events.htm to help
me understand how to trigger a macro based on a cell
value, but can't get it to work. I've put the following
code in "Module 1".
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "R32" Then
Application.EnableEvents = False
If Target.Value >37 Then
MsgBox "Total hours cannot be greater than 37!"
End If
Application.EnableEvents = True
End If
End Sub
In English, what I'm asking is, if the value of
(calculated) cell R32 is greater than 37, then display the
message box.
What I don't understand is this - In the Visual Basic
editor window, if I click Run, a dialog comes up asking me
for the name of the macro. The macro Worksheet_Change
doesn't appear. There might be something else wrong, but
since I can't get it to even run, it can't be tested.
Any advice will be deeply appreciated.
Haleigh