Trigger Macro Once On Data Change In Cell

  • Folks, as an inexperienced excel programmer/user I'd appreciate help with the following problem;

    I have an application that updates the text string in A1 every x minutes (time may vary). I'm trying to develop a toutine that will trigger a Macro/call a function/subroutine once only on each change of data (and then not trigger again until the next change...and must only trigger on change of data in this specific cell). So the timeline looks like this

    start A1 = "Apples", Fire macro once

    start + 10mins A1 = "Oranges", Fire Macro Once again

    start + 25mins A1 = "Pears", Fire Macro Once again


    Triggering the macro is no problem but constraining to one triggering is proving a problem (for me anyway) and is really holding up my application progress.

  • Re: Trigger Macro Once On Data Change In Cell

    Perhaps can you try next code in sheet's code

    Private Sub Worksheet_Change(ByVal Target As Range)
        Application.EnableEvents = False
        If (Target.Address = "$A$1") Then
            '   Your Code
        Application.EnableEvents = True
    End Sub

    Triumph without peril brings no glory: Just try

  • Re: Trigger Macro Once On Data Change In Cell


    Thanks for the suggestion but I can't get it to function unfortunately. I added in the 'end if' and can see the logic of what your suggesting (which I think is aimed at only switching on application events if there is a change in the content of A1).

    Like the idea but in it's current form it's not doing quite what I'd expected (i.e. the subroutine is not being triggered). Still looking into it though as the idea looks good!!.

  • Re: Trigger Macro Once On Data Change In Cell

    Darkyam, thank you.

    Yidrasil, we don't allow cross-posting on Oz without a link.

    MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question


    [SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!