getting a VBA macro to run continuously

Please post any questions regarding the program here.

Moderator: 2020vision

getting a VBA macro to run continuously

Postby zingomax » Thu May 31, 2012 8:57 am

Hi

New to VBA and battling
with it
I have this working as a simple way to update market

Sub start()

If Range("F26").Value = 0 Then
Range("Q2").Value = -1
Else: Range("Q2").Value = ""

End If

End Sub


But it only works if I run it manually. How can I get it to run every few seconds to pick up when F26 goes from a number to zero?
zingomax
 
Posts: 18
Joined: Thu May 31, 2012 7:34 am

Postby zingomax » Thu May 31, 2012 9:04 am

Perhaps a better option would be

Sub start()

If Range("F2").Value = "Closed" Then
Range("Q2").Value = -1
Else: Range("Q2").Value = ""

End If

End Sub

But again not sure how to make it run continuously
zingomax
 
Posts: 18
Joined: Thu May 31, 2012 7:34 am

Postby MarkRussell » Thu May 31, 2012 11:16 am

Hi,

Have a look at this thread:-
http://www.gruss-software.co.uk/forum/viewtopic.php?t=5132

Regards,
Mark
User avatar
MarkRussell
Site Admin
 
Posts: 1793
Joined: Tue Feb 20, 2007 6:38 pm
Location: Birmingham

Postby zingomax » Thu May 31, 2012 11:34 am

This is prbably too simple as approach as I could end up switching markets in the niddle of the next race.
I'll pose a different help question in a new topic
zingomax
 
Posts: 18
Joined: Thu May 31, 2012 7:34 am

Postby zingomax » Thu May 31, 2012 11:45 am

Thanks gary - that helped me understand what all the <>16 was all about.

Is there some good code to switch to the new market about 10 second before the scheduled off and stay in it in play until 10 second before the next one?

So you get the first part of the race and don't switch in the middle ever?
I came across your code to switch just before the off but this loses the inplay period
zingomax
 
Posts: 18
Joined: Thu May 31, 2012 7:34 am

Postby MarkRussell » Thu May 31, 2012 12:07 pm

Hi,

If you get the latest Beta version then cell D1 will display the official start time of the next race in your Quick Pick List.
If you are on the last race then the cell will be blank.
You can compare the current time with D1 to decide when to switch markets.
You should be able to adapt the example code that you already have to do this.
NB: However, if a race starts late or the race times are too close together then the switch to the new market can still happen when you don't want it to.

Regards,
Mark
User avatar
MarkRussell
Site Admin
 
Posts: 1793
Joined: Tue Feb 20, 2007 6:38 pm
Location: Birmingham


Return to Help

Who is online

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