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 copied the code at
the web site and it 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.
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. Help doesn't tell you anything
about how to run a macro other than by the Run command.
Any advice will be deeply appreciated.
Haleigh
Note: This is a re-post of a message I accidentally sent
to the MS Access forum yesterday.
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 copied the code at
the web site and it 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.
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. Help doesn't tell you anything
about how to run a macro other than by the Run command.
Any advice will be deeply appreciated.
Haleigh
Note: This is a re-post of a message I accidentally sent
to the MS Access forum yesterday.