q2 value -1

Please post any questions regarding the program here.

Moderator: 2020vision

q2 value -1

Postby MMichael » Tue Jun 22, 2021 5:05 pm

Hi
Sorry im sure this is a stupid question but i can't figure it out
vba is going through the quicklist until it finds the first market that isnt closed however when it reaches the first market that f2 is "" it doesn't stop and loads the next market - sometimes twice before stopping

on worksheet change event
Set market1 = Worksheets("main")

If Target.Columns.Count = 16 Then
Application.EnableEvents = False
If market1.Range("F2") <> "" Then
market1.Range("q2").Value = -1
End If

End If
Application.EnableEvents = True
End Sub

dunno what ive done wrong
any help will be appreciated

ta
mike
MMichael
 
Posts: 5
Joined: Fri May 14, 2021 12:57 pm

Re: q2 value -1

Postby Deestar » Wed Jun 23, 2021 8:50 am

Are the markets that it is skipping showing something else in F2 eg "Suspend" or is it scrolling through each market too fast? So F2 is not being updated immediately on market change or indeed q2? Not sure if Full Stream or polling refresh rates has an impact but worth checking.
Deestar
 
Posts: 262
Joined: Sun Apr 26, 2015 8:17 am

Re: q2 value -1

Postby MarkRussell » Thu Jun 24, 2021 11:14 am

HI,

It will be a timing issue.
A bit more code needed to ensure that it knows the next market is selected before the -1 is triggered again.
Try the following which checks if the next market is selected before moving on.

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
        End If
        currentMarket = [A1]
        If [F2] <>"" And Not marketSelected Then
            marketSelected = True
            [Q2] = -1
        End If       
        Application.EnableEvents = True       
    End If

End Sub


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

Re: q2 value -1

Postby MMichael » Thu Jun 24, 2021 2:09 pm

Hi

that extra code didn't help
still skips

regards
mike
MMichael
 
Posts: 5
Joined: Fri May 14, 2021 12:57 pm

Re: q2 value -1

Postby MarkRussell » Thu Jun 24, 2021 3:01 pm

Hi,

I tested the code and it definitely works.
Did you put the extra variables outside the sub (in the General part) as per my example code?

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

Re: q2 value -1

Postby MMichael » Thu Jun 24, 2021 3:45 pm

ahhh ty

currentmarket variable - needs to hold value when it leaves the sub - thats why its out of the main sub

ty that works

however i thought target.columns,count = 16 would of of waited until until the columns updated - so not sure why that didnt catch it

anyway ty very much for your help

ill probably put another help request soon

cheers
mike
MMichael
 
Posts: 5
Joined: Fri May 14, 2021 12:57 pm


Return to Help

Who is online

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