+ Reply to Thread
Results 1 to 5 of 5

stop a macro from running everytime a cell is changed

  1. #1
    bassfisher
    Guest

    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. #2
    Jim Thomlinson
    Guest

    RE: 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. #3
    bassfisher
    Guest

    RE: 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. #4
    Jim Thomlinson
    Guest

    RE: 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. #5
    bassfisher
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1