Running clock since start

Please post any questions regarding the program here.

Moderator: 2020vision

Running clock since start

Postby vanbuuts » Tue Apr 13, 2021 7:21 pm

I am looking to get a running clock in seconds in cell S1 (Can be any other) from the start of the race using VBA / Formula but drawing a blank. Anyone else done this or could advise simplest way to do this?

Tying myself in knots trying to code something but not getting anywhere
vanbuuts
 
Posts: 321
Joined: Thu Oct 16, 2014 8:55 pm

Re: Running clock since start

Postby vanbuuts » Tue Apr 13, 2021 8:11 pm

This is my existing code which has come from this forum, it basically skips to the next market at the end of a race and reloads the markets at midnight. If the seconds since off code could be embedded in here then great


Code: Select all
Option Explicit

Dim currentMarket As String, marketSelected As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)


 

 If Target.Columns.Count = 16 Then
             Application.EnableEvents = False
       
 
       
           If [A7] <> currentMarket Then marketSelected = False
        currentMarket = [A7]
        If [AB2] = "OK" And Not marketSelected Then
            marketSelected = True
              ThisWorkbook.Sheets("R1").Select
                                            [Q8] = -1
                                           
                                                                             End If
        Application.EnableEvents = True
End If

   


          If Target.Columns.Count = 16 Then
        Application.EnableEvents = False
        If triggerQuickPickListReload(1) Then
            triggerQuickPickListReload(1) = False
            Range("Q8").Value = -3
            triggerFirstMarketSelect(1) = True
        Else
            If triggerFirstMarketSelect(1) Then
                triggerFirstMarketSelect(1) = False
                Range("Q8").Value = -5
               
            End If
        End If
        Application.EnableEvents = True
    End If
     
   
End Sub



vanbuuts
 
Posts: 321
Joined: Thu Oct 16, 2014 8:55 pm

Re: Running clock since start

Postby Captain Sensible » Wed Apr 14, 2021 7:19 pm

Try replacing the top half of your code from above with

Code: Select all
If Target.Columns.Count = 16 Then
Application.EnableEvents = False
       
 
If [A7] <> currentMarket Then marketSelected = False: currentMarket = [A7]: [S1:S2] = ""
         

If [E8] = "In Play" Then
   
    If [S2] = "" Then [S2] = Time()
    [S1] = DateDiff("s", Time(), [S2])

End If
     
       
If [AB2] = "OK" And Not marketSelected Then
               
    marketSelected = True
    ThisWorkbook.Sheets("R1").Select
    [Q8] = -1
                                           
End If
   
   
Application.EnableEvents = True
End If


Should hopefully work as it's simply putting a timestamp in S2 when the race goes in play and then displaying the number of seconds from that time in S1. It clears those cells each time the market changes.
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Re: Running clock since start

Postby vanbuuts » Thu Apr 15, 2021 9:23 am

Cheers CS will give it a go
vanbuuts
 
Posts: 321
Joined: Thu Oct 16, 2014 8:55 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 27 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.

cron