CLEAR COLUMN

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

CLEAR COLUMN

Postby BERTRAND » Wed May 01, 2013 12:10 pm

Code: Select all
Option Explicit

Dim CellA1 As String

Private Sub Worksheet_Calculate()
 Dim varArray() As Variant
 
 With Sheet6
    If CellA1 <> .Cells(1, 1).Value Then
        CellA1 = .Cells(1, 1).Value
        varArray = .Range("A1:A50").Value
        .Range("B10000").End(xlUp).Offset(1, 0).Resize(UBound(varArray, 1), UBound(varArray, 2)).Value = varArray
    End If
End With

End Sub


I am using the above code to Log prices in column B. I would like to clear this column when the next race loads. Can someone tell me how to achieve this?
Many thanks Bert
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby osknows » Wed May 01, 2013 12:50 pm

Try this in the sheet object where the BA prices update.

Code: Select all
Option Explicit

Dim currentMarket As String

Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Columns.Count <> 16 Then Exit Sub
   
    Application.EnableEvents = False

    With Target.Parent
       
        If .Range("A1").Value <> currentMarket Then
       
               currentMarket = .Range("A1").Value
               Sheet6.Range("B:B").ClearContents
        End If
       
    End With
   
    Application.EnableEvents = True

End Sub
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby BERTRAND » Thu May 02, 2013 7:49 am

Thanks Os
Please excuse my woeful lack of VBA knowledge.
I have this inplay timer in sheet1. How do I integrate your code?
Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
If updating Then Exit Sub
Application.EnableEvents = False
updating = True
With Sheet1
    If .Cells(2, 5) = "In Play" Then
    If .Cells(1, 27) = "" Then .Cells(1, 27) = .Cells(2, 2)
    If .Cells(1, 27) <> "" Then .Cells(1, 28) = .Cells(2, 2) - .Cells(1, 27)
    End If
    If .Cells(2, 5) <> "In Play" And .Cells(2, 6) <> "Suspended" Then
    .Cells(1, 27) = ""
    .Cells(1, 28) = ""
    End If
End With
updating = False
Application.EnableEvents = True
End Sub
BERTRAND
 
Posts: 99
Joined: Thu Feb 03, 2011 4:15 pm

Postby osknows » Thu May 02, 2013 11:16 am

Code: Select all
Option Explicit

Dim currentMarket As String
Dim updating As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)

If updating Then Exit Sub
Application.EnableEvents = False
updating = True

With Sheet1

    If .Range("A1").Value <> currentMarket Then
       
        currentMarket = .Range("A1").Value
        Sheet6.Range("B:B").ClearContents
    End If
   
    If .Cells(2, 5) = "In Play" Then
   
        If .Cells(1, 27) = "" Then .Cells(1, 27) = .Cells(2, 2)
        If .Cells(1, 27) <> "" Then .Cells(1, 28) = .Cells(2, 2) - .Cells(1, 27)
       
    ElseIf .Cells(2, 5) <> "In Play" And .Cells(2, 6) <> "Suspended" Then
   
        .Cells(1, 27) = ""
        .Cells(1, 28) = ""
    End If
   
End With

updating = False
Application.EnableEvents = True
End Sub
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am


Return to Discussion

Who is online

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