VBA help Needed

Please post any questions regarding the program here.

Moderator: 2020vision

VBA help Needed

Postby Shaun » Mon Dec 15, 2008 1:39 am

Hi All,

I am using this code to clear the bet ref cells when i manually change races and it works great.

But i also need it to clear the cells if the market is suspended early, what happens is some times 5 minutes before the off the market will suspend for a few seconds then return to normal betting but it leaves a market suspended in the bet ref and if i don't see it and try to place a bet it won't work so auto betting is useless right now.

All i need added to the macro is if the market is suspended and the time for the race has not reached zero that it will clear the cells.


Code: Select all
Private Sub Worksheet_Calculate()
Static MyMarket As Variant
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
If [A1].Value = MyMarket Then
GoTo Xit
Else
MyMarket = [A1].Value
Range("T5:X50").Value = ""
Range("A5:P50").Value = ""
End If
Xit:
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub

Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby Shaun » Tue Dec 16, 2008 4:47 pm

Still needing some help here thanks.
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby alrodopial » Tue Dec 16, 2008 6:55 pm

Try this - dont know if the systax is correct:

Code: Select all
Private Sub Worksheet_Calculate()
Static MyMarket As Variant
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
If [A1].Value = MyMarket Then
    If [F2].Value = "Suspended" And Left(D2, 1) = "-" Then
        Range("T5:X50").Value = ""
        Range("A5:P50").Value = ""
    Else
        GoTo Xit
    End If
GoTo Xit
Else
MyMarket = [A1].Value
Range("T5:X50").Value = ""
Range("A5:P50").Value = ""
End If
Xit:
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub


Be carrefull - how many times it will fire the same bet - if so-
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby Shaun » Wed Dec 17, 2008 3:40 am

Thanks will give it a try, it shouldn't fire the bet as there is nothing in the trigger just the bet ref, but will check it to make sure.
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby alrodopial » Wed Dec 17, 2008 6:52 am

Your criteria are met, a bet is placed.
The market 5 mins before the off goes suspended, the above code clears the bet reff but your criteria still are met so another bet is placed and so on as long the market remains suspended.
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm


Return to Help

Who is online

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