Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default stop a macro from running everytime a cell is changed

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" !
also i would like to add the date due in the message box if possible that is
a reult of cell "FE12".

any help would be aprreciated

thanks in advance

bassfisher

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default stop a macro from running everytime a cell is changed

The argument Target is the cell that just changed, so you want something like

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$FE$11" and Target.Value = 1 Then
MsgBox "VEHICLE MAY BE DUE FOR A SERVICE !!", vbBEEP + vbOKOnly
End If

End Sub


--
HTH...

Jim Thomlinson


"bassfisher" wrote:

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" !
also i would like to add the date due in the message box if possible that is
a reult of cell "FE12".

any help would be aprreciated

thanks in advance

bassfisher

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default stop a macro from running everytime a cell is changed

jim, thanks for the info, but now the message box doesn't appear as a an
alert to the user! ????
bassfisher

"Jim Thomlinson" wrote:

The argument Target is the cell that just changed, so you want something like

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$FE$11" and Target.Value = 1 Then
MsgBox "VEHICLE MAY BE DUE FOR A SERVICE !!", vbBEEP + vbOKOnly
End If

End Sub


--
HTH...

Jim Thomlinson


"bassfisher" wrote:

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" !
also i would like to add the date due in the message box if possible that is
a reult of cell "FE12".

any help would be aprreciated

thanks in advance

bassfisher

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default stop a macro from running everytime a cell is changed

Is FE11 a Formula by chance. In that case the target is not FE11 and the
warning will not fire. You need to look at the precidents of that function
and change the line

(Target.Address = "$?$" Or Target.Address = "$?$") and Range("FE11") = 1
--
HTH...

Jim Thomlinson


"bassfisher" wrote:

jim, thanks for the info, but now the message box doesn't appear as a an
alert to the user! ????
bassfisher

"Jim Thomlinson" wrote:

The argument Target is the cell that just changed, so you want something like

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$FE$11" and Target.Value = 1 Then
MsgBox "VEHICLE MAY BE DUE FOR A SERVICE !!", vbBEEP + vbOKOnly
End If

End Sub


--
HTH...

Jim Thomlinson


"bassfisher" wrote:

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" !
also i would like to add the date due in the message box if possible that is
a reult of cell "FE12".

any help would be aprreciated

thanks in advance

bassfisher

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default stop a macro from running everytime a cell is changed

thanks again jim, i'll give it a shot and let you know how it works
bassfisher

"Jim Thomlinson" wrote:

Is FE11 a Formula by chance. In that case the target is not FE11 and the
warning will not fire. You need to look at the precidents of that function
and change the line

(Target.Address = "$?$" Or Target.Address = "$?$") and Range("FE11") = 1
--
HTH...

Jim Thomlinson


"bassfisher" wrote:

jim, thanks for the info, but now the message box doesn't appear as a an
alert to the user! ????
bassfisher

"Jim Thomlinson" wrote:

The argument Target is the cell that just changed, so you want something like

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$FE$11" and Target.Value = 1 Then
MsgBox "VEHICLE MAY BE DUE FOR A SERVICE !!", vbBEEP + vbOKOnly
End If

End Sub


--
HTH...

Jim Thomlinson


"bassfisher" wrote:

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" !
also i would like to add the date due in the message box if possible that is
a reult of cell "FE12".

any help would be aprreciated

thanks in advance

bassfisher



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop running macros everytime I run excel? SusieOrtiz Excel Discussion (Misc queries) 1 August 18th 09 05:20 AM
Password Prompt Everytime a Link is Changed [email protected] Excel Discussion (Misc queries) 1 June 7th 07 07:55 PM
How do I stop a Macro from running? JulianB Excel Worksheet Functions 1 April 10th 06 10:33 PM
stop from running everytime a cell is changed bassfisher[_4_] Excel Programming 6 October 3rd 05 09:12 PM
Automaticlly Running Macro on Changed Cell Chris Excel Programming 1 December 2nd 03 03:54 PM


All times are GMT +1. The time now is 03:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"