Q2 Trigger

Please post any questions regarding the program here.

Moderator: 2020vision

Q2 Trigger

Postby Shaun » Sun Sep 05, 2010 2:27 pm

I have tried a couple codes on here but no luck, i wish to switch markets after bets placed.

I have a formula in T3 that counts the submitted bets and when it equals the amount of bets that are to be placed it puts a 1 in cell Q3

What i need is VBA that will move 1 race forward, then my code will pass the next set of bets then i want the race to move again.
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby GaryRussell » Mon Sep 06, 2010 7:47 am

It's cell Q2 that can be used to trigger the next market.
See http://gruss-software.co.uk/forum/viewtopic.php?t=5163 for an example where this is used. Note in this example the use of the flag variable marketSelected to prevent multiple market changes.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Shaun » Mon Sep 06, 2010 12:20 pm

i tried to adapt my code to yours, but not exactly working, does it make any sense.

(code]
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 [A1] <> currentMarket Then marketSelected = False
currentMarket = [A1]
If Sheets("Data").Range("J3").Value = "L" Then
Sheets("Control").Range("P4").Value = "Finished Bets"
GoTo Xit
Else
If Sheets("Data").Range("R3").Value = Sheets("Data").Range("U3").Value And Not marketSelected Then
marketSelected = True
[Q2] = -1
End If
End If
Application.EnableEvents = True
End If
Xit:
End Sub
[/code]
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby GaryRussell » Mon Sep 06, 2010 1:21 pm

Looks ok. Where does it fail? Do you see -1 appear in Q2?
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Shaun » Mon Sep 06, 2010 2:43 pm

No Does not put -1 in the cell
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby GaryRussell » Mon Sep 06, 2010 2:59 pm

Maybe you should verify that part of your code is running. Use a debug statement. example below. If it does not output "Changing market" in the immediate window then Sheets("Data").Range("U3").Value And Not marketSelected is not evaluating as true.

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 [A1] <> currentMarket Then marketSelected = False
currentMarket = [A1]
If Sheets("Data").Range("J3").Value = "L" Then
Sheets("Control").Range("P4").Value = "Finished Bets"
GoTo Xit
Else
If Sheets("Data").Range("R3").Value = Sheets("Data").Range("U3").Value And Not marketSelected Then
marketSelected = True
Debug.Print "Changing market"
[Q2] = -1
End If
End If
Application.EnableEvents = True
End If
Xit:
End Sub
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Shaun » Mon Sep 06, 2010 4:38 pm

I will have to work on it because it does not fire in the -1
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia


Return to Help

Who is online

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