Auto Fire macro

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

Moderator: 2020vision

Auto Fire macro

Postby dixiedean » Tue Jan 08, 2013 12:33 am

Hi All

Is there anyway that when BA loads a new market i can get a macro to run automatically? If i use a formula to pull the time from the market tab and it updates a cell using that ormula how do i get it to fire the macro, if i enter the time manually the macro runs in ie: 14:00 I am using excel 2007

Cheers

D
dixiedean
 
Posts: 28
Joined: Tue Sep 13, 2011 6:42 pm

Postby negapo » Tue Jan 08, 2013 9:52 am

You can check for the marketid to change and then fire the macro whenever it changes like this:

Code: Select all
Public CurrentMarketID As Long
Private Sub Worksheet_Change(ByVal Target As Range)
    If CurrentMarketID <> Me.Cells(2, 1) Then
        CurrentMarketID = Me.Cells(2, 1)
        MyMacroName
    End If
End Sub


Me.Cells(2, 1) is the location of the MarketID in the sheet, i don't know where it is so you have to change it.
negapo
 
Posts: 179
Joined: Thu Mar 19, 2009 1:17 pm
Location: Porto, Portugal

Postby dixiedean » Tue Jan 08, 2013 10:10 pm

negapo wrote:You can check for the marketid to change and then fire the macro whenever it changes like this:

Code: Select all
Public CurrentMarketID As Long
Private Sub Worksheet_Change(ByVal Target As Range)
    If CurrentMarketID <> Me.Cells(2, 1) Then
        CurrentMarketID = Me.Cells(2, 1)
        MyMacroName
    End If
End Sub


Me.Cells(2, 1) is the location of the MarketID in the sheet, i don't know where it is so you have to change it.


Thanks mate that triggers a macro but i have run into another problem my macro only runs if i input a time say 14:00 into cell a19 but will only run if cell a5 is formatted as text? I have this in cell a20 =MID(A1,SEARCH("-",A1)+1,6) which will pull out the 14:00 from the event string ie: Pbarr 8th Jan - 14:100 A4 480m, i then have a macro to copy a20 and paste it into a19 which i thought would run my macro but when i paste the 14:00 into cell a19 it changes the format from text to general and the macro wont fire?

Heres my macro, any help much appreciated i seem to be losing most of my dwindling hairline to this
thought of when marketid changes i use a :shock:

Code: Select all
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

Application.ScreenUpdating = False
 If Target.Address = "$A$5" Then
        Dim raceTime As String
        raceTime = Target.Value
       
        If raceTime <> "" Then
           Worksheets("QUICK RACE VIEW").Activate
           For Counter = 1 To 30000
               Set curCell = Worksheets("QUICK RACE VIEW").Cells(Counter, 1)
               If curCell.Value <> "" Then
               
                   Application.DisplayAlerts = False
                   
                   If InStr(1, curCell.Value, raceTime) > 0 Then
   
                   Rows(CStr(curCell.Row) & ":" & CStr(curCell.Row + 6)).copy
                   Worksheets("MASTER").Range("A11:g18").PasteSpecial xlPasteValues, SkipBlanks:=True
                   Application.CutCopyMode = False
       
                   Application.DisplayAlerts = True
                   
                   End If
               End If
           Next Counter
           Worksheets("MASTER").Activate
         
    Range("a6").Select
    Application.ScreenUpdating = True
        End If
dixiedean
 
Posts: 28
Joined: Tue Sep 13, 2011 6:42 pm


Return to Discussion

Who is online

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