stop from running everytime a cell is changed

B

bassfisher

i am running the following macro,

Private Sub Worksheet_Change(ByVal Target As Range)

If Range("FE11") = 1 Then
MsgBox "VEHICLE MAY BE DUE FOR A SERVICE !!", vbBEEP +
vbOKOnly
End If

End Sub

i am a newbie to programming and can't figure out how to stop it from
running everytime any cell value is changed in the worksheet other than
"FE11" !

any help would be aprreciated

thanks in advance

bassfisher
 
V

Vasant Nanavati

Add a line at the beginning:

If Intersect(Range("FE11"), Target) Is Nothing Then Exit Sub
 
T

Tom Ogilvy

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address(0,0) = "FE11" then
if Range("FE11") = 1 Then
MsgBox "VEHICLE MAY BE DUE FOR A SERVICE !!", vbBEEP +
vbOKOnly
End If
End if
End Sub
 
B

bassfisher

thanks for the advice, but it didn't solve the problem, now it appears
as tho the macro stopped running.
 
D

Dave Peterson

Did you disable macros when you opened the workbook?

Did you disable events while you were testing?
 
B

bassfisher

hello dave, no macros are enabled and i am sure the events are on,
think, not sure! so much to learn! so little time!

bassfishe
 
D

Dave Peterson

Does this: "no macros are enabled" mean that macros are disabled?

If yes, set the security to medium and reopen your workbook and allow macros to
run.

(I didn't think that was the problem...)

And you're sure the code is under the correct worksheet???
 

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

Top