Selection names not clearing for next race in Excel

Please post any questions regarding the program here.

Moderator: 2020vision

Selection names not clearing for next race in Excel

Postby billstickers » Tue Jan 06, 2009 10:37 am

Sometimes I am finding that some selection names in column A of my spreadsheet are remaining from the previous race, if the current race has less runners than the previous race. As I am using this field to make decisions, this then causes an error in Excel and stops my VBA program from running.
billstickers
 
Posts: 18
Joined: Tue Aug 19, 2008 11:23 pm
Location: United Kingdom

Postby GaryRussell » Tue Jan 06, 2009 10:46 am

I'm not aware of this issue.

How often does it occur?
Which racing markets are affected? UK, US etc.
Can you reproduce this problem by logging to a blank Excel sheet and switching markets until the problem occurs or does it only affect your spreadsheet?
User avatar
GaryRussell
Site Admin
 
Posts: 9708
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby billstickers » Tue Jan 06, 2009 11:28 am

This issue has been occuring about once a day for a week or so. It seemed to start when I was looking at US racing markets, but is happening now in UK markets. It does not happen every time, just sometimes.

I will try to reproduce the problem as you have suggested. If I can reproduce it, or when it happens again, shall I send you a copy of the spreadsheet? If so what email address shall I send it to?
billstickers
 
Posts: 18
Joined: Tue Aug 19, 2008 11:23 pm
Location: United Kingdom

Postby MarkRussell » Tue Jan 06, 2009 11:48 am

Hi,

Please send to admin@gruss-software.co.uk

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

Postby jokerjoe » Tue Jan 06, 2009 12:05 pm

Not sure if this is relevant, it might affect your code, but I noticed that it takes a couple of refreshes (of the 16 main columns) to clear the previous runners in the situation you describe (less runners in new race). As a workaround at a change of market I wait for a few refreshes to pass before allowing any code to run.
User avatar
jokerjoe
 
Posts: 122
Joined: Wed May 09, 2007 12:00 pm

Postby billstickers » Tue Jan 06, 2009 12:10 pm

Thanks Jokerjoe, I think that may be the solution. What is the best way to allow a few refreshes to happen, before running any code?
billstickers
 
Posts: 18
Joined: Tue Aug 19, 2008 11:23 pm
Location: United Kingdom

Postby jokerjoe » Tue Jan 06, 2009 12:25 pm

I put a refresh counter in as a module-wide variable, the basis for all my worksheets will look something like this:

Code: Select all
Private MyMarket As String
Private RefreshCount As Long

Private Sub Worksheet_Change(ByVal Target As Range)
   
    Application.EnableEvents = False
    Application.Calculation = xlCalculationManual
   
    Select Case Target.Columns.Count
        Case 16 'odds and market info update
           
            'check to see if market changed
            If wsBA.Range("A1").Value = MyMarket Then
                RefreshCount = RefreshCount + 1
            Else
                MyMarket = wsBA.Range("A1").Value
                RefreshCount = 1
            End If
                       
            If RefreshCount > 3 Then
           
                    '#################  CODE HERE
           
            End If
                       
        Case 5 'bets update
        Case 1 'refresh update
        Case 8 'bet column headers update
        Case Else
    End Select

    Application.EnableEvents = True
    Application.Calculation = xlCalculationAutomatic

End Sub



Possibly being a bit over the top with the case specifying! I believe theres a 2-column update too, just after the bets get read.
User avatar
jokerjoe
 
Posts: 122
Joined: Wed May 09, 2007 12:00 pm

Postby billstickers » Tue Jan 06, 2009 12:56 pm

My code is in a Private Sub Worksheet_Calculate(), do I scap that and put it all in where you say ####CODE HERE, in a Private Sub Worksheet_Change(ByVal Target As Range)?
billstickers
 
Posts: 18
Joined: Tue Aug 19, 2008 11:23 pm
Location: United Kingdom

Postby jokerjoe » Tue Jan 06, 2009 1:11 pm

Yup pretty much.
User avatar
jokerjoe
 
Posts: 122
Joined: Wed May 09, 2007 12:00 pm

Postby billstickers » Tue Jan 06, 2009 6:52 pm

Thanks Jokerjoe, I think I've cracked this now.

Cheers
billstickers
 
Posts: 18
Joined: Tue Aug 19, 2008 11:23 pm
Location: United Kingdom


Return to Help

Who is online

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