Strange - Updating twice - bug?

Please post any questions regarding the program here.

Moderator: 2020vision

Strange - Updating twice - bug?

Postby alrodopial » Sun Jun 05, 2011 10:47 pm

Garry please test the below code:
Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Columns.Count = 16 Then
        Application.EnableEvents = False
            Lrow = Cells(Rows.Count, "A").End(xlUp).Row
            Range("A" & Lrow + 1) = "YES"
        Application.EnableEvents = True
    End If
End Sub


It simply puts "YES" in the first free cell in column A.
Place something in cell A30 so any update will be below this cell.
Chose a refresh rate of lets say 2 secs.
In the horse market , from the - Folk 6June - chose the first race from the quick pick list and watch the "YES" that is entered in column A.
At every refresh it puts one "YES" in the next available cell, then you pick the next race in the list - it's ok - but if you choose the 15:30 win race it puts instantly a "yes" in the next TWO cells.
It does it only if you come to this market from another market.
It looks like it updates the 16 rows twice.
It does the same with other markets from the list but not so often.

Can you check it?
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby GaryRussell » Mon Jun 06, 2011 6:37 am

It's not a bug. Try the following code and you will see.

Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Columns.Count = 16 Then
        Application.EnableEvents = False
            lrow = Cells(Rows.Count, "A").End(xlUp).Row
            Range("A" & lrow + 1) = Now
            Range("B" & lrow + 1) = Target.Row & "," & Target.Column
            Range("C" & lrow + 1) = Target.Rows.Count
        Application.EnableEvents = True
    End If
End Sub


The first of the two updates is to clear the rows from the previous market if the next market has fewer selections. The above code outputs more information so you can see it's not updating the exact same cells.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby alrodopial » Mon Jun 06, 2011 8:10 pm

What code do you suggest to identify this "false" 16 rows update and bypass it?( run any initialise market code at the next refresh )
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby alrodopial » Mon Jun 06, 2011 8:17 pm

What BA does when you have just opened a sheet that you used it yesterday and has data in cells?
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby alrodopial » Mon Jun 06, 2011 9:55 pm

A simple flag will do the job
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby GaryRussell » Tue Jun 07, 2011 7:36 am

What BA does when you have just opened a sheet that you used it yesterday and has data in cells?

It will do the same. It will check if the row below the last selection is blank and if it is not it will do a separate write to blank them.



What code do you suggest to identify this "false" 16 rows update and bypass it?( run any initialise market code at the next refresh )


Assuming you output at A1 then check for 16 columns and the start row being 1 as below.
Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Columns.Count = 16 and Target.Row=1 Then
        Application.EnableEvents = False
            lrow = Cells(Rows.Count, "A").End(xlUp).Row
            Range("A" & lrow + 1) = Now
            Range("B" & lrow + 1) = Target.Row & "," & Target.Column
            Range("C" & lrow + 1) = Target.Rows.Count
        Application.EnableEvents = True
    End If
End Sub
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK


Return to Help

Who is online

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