Q2 HELP

Please post any questions regarding the program here.

Moderator: 2020vision

Q2 HELP

Postby BERTRAND » Mon Feb 20, 2012 8:57 am

Hi
I want to achieve the following function in Q2,

Code: Select all
IF(AND(E2="In Play",F2="Suspended"),-1,"")


It seems that I need VBA to do this.
Can someone point me in the right direction.
Many thanks
Bert
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby GaryRussell » Mon Feb 20, 2012 9:44 am

User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby BERTRAND » Mon Feb 20, 2012 10:21 am

Hi Gary,
Yes I looked at that code earlier, but it's timing based. I only need to refer to the contents of E2 and F2. -so that the market changes immediately the race finishes. (Inplay markets only)
Bert
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby GaryRussell » Mon Feb 20, 2012 3:52 pm

Put the following code in sheet1. Please note that because it can be in play and suspended briefly at the start of the race it only triggers when it has been in play for at least 20 seconds.

Code: Select all
Option Explicit

Dim currentMarket As String
Dim inPlay As Boolean
Dim inPlayTime As Date
Dim marketChanged As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Columns.Count = 16 Then
        If [A1] <> currentMarket Then
            currentMarket = [A1]
            inPlay = False
            marketChanged = False
        End If
        If [E2] = "In Play" Then
            If Not inPlay Then
                inPlay = True
                inPlayTime = Now
            End If
            If [F2] = "Suspended" And Not marketChanged And DateDiff("s", inPlayTime, Now) > 20 Then
                marketChanged = True
                Application.EnableEvents = False
                [Q2] = "-1"
                Application.EnableEvents = True
            End If
        Else
            inPlay = False
        End If
    End If
End Sub
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby BERTRAND » Tue Feb 21, 2012 3:55 am

Thanks for your time Gary, I'm sure the code will be useful for many members.

The reasons I desired this function were twofold, firstly if a meeting is way behind schedule (meetings in separate tabs, and triggering inplay) then I don't miss a race.

Secondly--It will massively reduce my data requests. My default refresh time of 0.2s kicks in 30sec before a race, otherwise it is 1s. But all the time the inplay flag is true and the race has finished it is still requesting at 8-10rps.

Cheers
Bert
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby SenseiCRO » Tue Feb 21, 2012 4:03 pm

Hello,

I have some different code for switching races. I want to switch to the next race in the Quick Pick list when the current race goes to "Suspended" status when it is in the "In Play" mode.

Here is my code:

If Me.Cells(2, 5).Value = "In Play" And Me.Cells(2, 6).Value = "Suspended" Then

[Q2] = -1
End If


The problem is that it switches to the next race, but when it shows in the grid, it switches to the second race. So, it doesn't advance 1 race, but 2 races.

Where's my code wrong?

Thanks for your help.

Cheers everyone,
Dean
User avatar
SenseiCRO
 
Posts: 56
Joined: Mon Jun 06, 2011 8:53 pm

Postby osknows » Tue Feb 21, 2012 4:51 pm

Hi Dean,

Use Gary's code above. If you remove the bolded part from the line below it will perform exactly your requirements or leave it there for added protection

If [F2] = "Suspended" And Not marketChanged And DateDiff("s", inPlayTime, Now) > 20 Then
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby BERTRAND » Wed Feb 22, 2012 1:51 pm

When I paste the code underneath the timer code I use in sheet 1, the workbook will not link to BA. Help!
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 37 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.