The macro receives distortion after midnight

Please post any questions regarding the program here.

Moderator: 2020vision

The macro receives distortion after midnight

Postby bines » Sat Sep 19, 2009 11:09 pm

Hi gary,
I am a user in the macro this that gave -
Private Sub Worksheet_Change(ByVal Target As Range)
If updating Then Exit Sub
updating = True
If Cells(2, 5) = "In Play" Then
If Cells(1, 27) = "" Then Cells(1, 27) = Cells(2, 3)
If Cells(1, 27) <> "" Then Cells(1, 28) = DateDiff("s", Cells(1, 27), Cells(2, 3))
End If
If Cells(2, 5) <> "In Play" And Cells(2, 6) <> "Suspended" Then
Cells(1, 27) = ""
Cells(1, 28) = ""
End If
updating = False
End Sub

The game started according to local clock in 23.00 tonight,After the midnight.The datum of the seconds passed to the minus with big number if can improve the macro?
bines
 
Posts: 16
Joined: Thu Sep 17, 2009 12:44 pm

Postby osknows » Mon Sep 21, 2009 1:34 pm

if you want your timer to rest at midnight use

Code: Select all
'reset timer
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False

If Cells(2, 5) = "In Play" Then
If Cells(1, 27) = "" Or Cells(1, 27) > Cells(2, 3) Then Cells(1, 27) = Cells(2, 3)
If Cells(1, 27) <> "" Then Cells(1, 2) = DateDiff("s", Cells(1, 27), Cells(2, 3))
End If
If Cells(2, 5) <> "In Play" And Cells(2, 6) <> "Suspended" Then
Cells(1, 27) = ""
Cells(1, 2) = ""
End If

Application.EnableEvents = True
End Sub



If you want it to continue incrementing after midnight use

Code: Select all
Public Count As Integer
'continue increment timer
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False

If Cells(2, 5) = "In Play" Then
If Cells(1, 27) = "" Then
    Cells(1, 27) = Cells(2, 3)
    Count = 0
End If

If Cells(1, 27) > Cells(2, 3) Then
 Cells(1, 27) = Cells(2, 3)
 Count = Count + Cells(1, 2) + 1
End If

If Cells(1, 27) <> "" Then Cells(1, 2) = DateDiff("s", Cells(1, 27), Cells(2, 3)) + Count
End If
If Cells(2, 5) <> "In Play" And Cells(2, 6) <> "Suspended" Then
Cells(1, 27) = ""
Cells(1, 2) = ""
End If

Application.EnableEvents = True
End Sub
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby bines » Mon Sep 21, 2009 4:37 pm

osknows, thank you !
bines
 
Posts: 16
Joined: Thu Sep 17, 2009 12:44 pm


Return to Help

Who is online

Users browsing this forum: Bing [Bot] and 54 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.