Update Balance

Please post any questions regarding the program here.

Moderator: 2020vision

Update Balance

Postby Steve Voltage » Fri Dec 31, 2010 11:15 am

I would like to update the balance every time a bet is placed. I have tried using the following code to activate a macro when cell T1 changes. All works well if T1 is changed manually but not when connected to ba. Any ideas please?

Code: Select all
 Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" Then
     Macro2
End If

End Sub



[/code]
Steve Voltage
 

Re: Update Balance

Postby Steve Voltage » Fri Dec 31, 2010 11:16 am

[quote="Arnold"]I would like to update the balance every time a bet is placed. I have tried using the following code to activate a macro when cell T1 changes. All works well if T1 is changed manually but not when connected to ba. Any ideas please?

Code: Select all
 Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" Then
     Macro2
End If

End Sub



why is there no edit button :roll:



Code: Select all
 Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$T$1" Then
     Macro2
End If

End Sub
Steve Voltage
 

Postby GaryRussell » Fri Dec 31, 2010 1:24 pm

Cell T1 is never updated by BA therefore the target is never T1. Also the worksheet change event is only fired when the contents are overwritten by a write operation from BA or manual input. If you have a formula in T1 and you are expecting it to fire a worksheet change event if the formula produces a different value then this is not going to happen.

When it logs the bet refs after placement it updates columns T to W so you can use the following code.

Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 20 And Target.Columns.Count = 4 Then
       Macro2
    End If
End Sub
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Steve Voltage » Fri Dec 31, 2010 8:43 pm

GaryRussell wrote:Cell T1 is never updated by BA therefore the target is never T1. Also the worksheet change event is only fired when the contents are overwritten by a write operation from BA or manual input. If you have a formula in T1 and you are expecting it to fire a worksheet change event if the formula produces a different value then this is not going to happen.

When it logs the bet refs after placement it updates columns T to W so you can use the following code.

Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 20 And Target.Columns.Count = 4 Then
       Macro2
    End If
End Sub


Thanks Gary works a treat. The only problem i have is that i keeping getting an error due to the existing code for that sheet

Code: Select all
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Columns.Count = 16 Then
        Application.EnableEvents = False
        If triggerQuickPickListReload(6) Then
            triggerQuickPickListReload(6) = False
            Range("Q2").Value = -3.1
            triggerFirstMarketSelect(6) = True
        Else
            If triggerFirstMarketSelect(6) Then
                triggerFirstMarketSelect(6) = False
                Range("Q2").Value = "=Q1"
            End If
        End If
        Application.EnableEvents = True
    End If
End Sub[code/]

Could somebody please show me the light on how to incorporate the two bits of code on one sheet. Obviously excel isn't really my strongest subject
   :oops:
Steve Voltage
 


Return to Help

Who is online

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