Macro Problem

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

Moderator: 2020vision

Macro Problem

Postby Shaun » Mon Sep 19, 2011 1:17 am

I know i have asked this before but not sure if i got the answer or understood it.

I have a macro that fires when bets are placed, this issue is if another workbook is open it will cause an error in the macro, what can i add so i can have other sheets open with the same macro and not cause an error.

Code: Select all

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False
With ThisWorkbook
If .Sheets("Data").Range("T2").Value <> 1 Then
   .Sheets("Data").Range("T3").Value = 0
End If
If .Sheets("Data").Range("T2").Value = 1 And Sheets("Data").Range("T3").Value <> 1 Then
    .Sheets("Results").Range("N" & Rows.Count).End(xlUp).Offset(1, 0).Resize(24, 2).Value = Sheets("Control").Range("AD15:AE55").Value
    .Sheets("Data").Range("T3").Value = 1
End If
Application.EnableEvents = True
End With
End Sub
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby alrodopial » Mon Sep 19, 2011 5:34 am

You missed the dot at
'=Sheets("Control").Range("AD15:AE55").Value'

'=.Sheets("Control").Range("AD15:AE55").Value'
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby alrodopial » Mon Sep 19, 2011 5:35 am

Also at the
'And Sheets("Data").Range("T3").Value <> 1'

'And .Sheets("Data").Range("T3").Value <> 1'
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby alrodopial » Mon Sep 19, 2011 5:37 am

At your case the dot means : ThisWorkbook
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby Shaun » Mon Sep 19, 2011 9:54 am

oh thought i only had to put that at the first one, will add it and see if it does the trick.
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia


Return to Discussion

Who is online

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