Using a countdown timer to launch macros

  • I have commercial software connected to a betting exchange. The prices, volume data etc are loaded directly to an excel spreadsheet. There is a timer such that when one race finishes the next race, in time order, will load automatically. On another worksheet "Bet Angel", there is a countdown timer in cell F4. It counts in minutes and seconds down to official race start time '00:00:00' and then goes onto a negative countdown until the actual race starts.


    I have macros fired manually by trigger buttons on sheet "Price Order" called Copy_Race and Trigger_Bet. What I would like to do is trigger both macros automatically at a specified time, "let's say 00:00:00". I've tried the following, for one of the macros, without success (you experts will probably laugh?):


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Range("Bet Angel!$F$4").Value = TimeValue("00:00:00") Then
    Call Copy_Race
    End If
    End Sub


    Finally, because the Global settings will display a new race worksheet within a few minutes, I need the macro to rearm, as it were.


    Thanks for taking the time to read :)

  • Re: Using a countdown timer to launch macros


    Try this in the "Bet Angel" sheet module:

    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
        
        If Not Intersect(Target, Range("F4")) Is Nothing Then
            If Format(Range("F4").Value, "HH:MM:SS") = "00:00:00" Then
                Copy_Race
                Trigger_Bet
            End If
        End If
        
    End Sub

    PS please use CODE tags.

  • Re: Using a countdown timer to launch macros


    Thanks John_w, I didn't end up trying your solution. I doubt if it would've worked on the 'Price Order' sheet. I found a solution but it had to be placed on the 'Bet Angel' sheet as that's where the feed comes in to. Unless you had a copy of the commercial software you probably wouldn't have sussed it?
    Cheers

  • Re: Using a countdown timer to launch macros


    Quote from rinconpaul;737520

    I found a solution but it had to be placed on the 'Bet Angel' sheet

    That's what I said! Actually, I have used Bet Angel before.

Participate now!

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