Maxro Help

Please post any questions regarding the program here.

Moderator: 2020vision

Postby osknows » Fri Sep 24, 2010 12:47 pm

There's an error here

IF .Sheets("Venue").Range("Z5:Z44").Value = ""


If what?
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby osknows » Fri Sep 24, 2010 12:51 pm

Possibly you mean..

IF application.worksheetfunction.countA(.Sheets("Venue").Range("Z5:Z44")) = 0 then
.Sheets("Venue").Range("Z5:Z44").Value = .Sheets("Venue").Range("AA5:AA44").Value

Else

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

Postby Shaun » Fri Sep 24, 2010 1:28 pm

Yeah thats incorrect, i have made to many code changes to even know where i am, i might just search the forum i am sure the answer i need is in here as it is not that hard a task.

Thanks anyways.
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby Shaun » Fri Sep 24, 2010 1:41 pm

This was the code i was trying to write.

Code: Select all
 
Private Sub Worksheet_Calculate()
Static MyMarket As Variant
Application.EnableEvents = False
Application.Calculation = xlCalculationManual

With ThisWorkbook
If .Sheets("Venue").Range("AA2").Value = .Sheets("Venue").Range("AG3").Value Then
   .Sheets("Venue").Range("Z5:Z44").Value = Sheets("Venue").Range("AA5:AA44").Value
   
Else
   
    If [A1].Value = MyMarket Then
        GoTo Xit
    Else
        MyMarket = [A1].Value
        .Sheets("Venue").Range("Z5:Z44").Value = ""
        .Sheets("Venue").Range("Z5:Z44").Value = Sheets("Venue").Range("AA5:AA44").Value
    End If
   
End If
End With

Xit:
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby osknows » Fri Sep 24, 2010 1:48 pm

The code looks fine. The only thing I can think of is possibly on this test

If .Sheets("Venue").Range("AA2").Value = .Sheets("Venue").Range("AG3").Value Then

Either cell AA2 or AG3 has an error as the code runs. Eg if you have a lookup that returns #N/A momentarily?
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby Shaun » Fri Sep 24, 2010 2:36 pm

AA2= D2 and is formated to time.
AG3 has formula =AF2/1440
AF2 is just a number for example 30 to indicate 30 minutes
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby Shaun » Sat Sep 25, 2010 1:50 am

Just to let you know i used this code and it works fine not crash, must have somrthing to do with the Calculate event, not sure what as i have used it in the paste fine.

Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
Static MyMarket As Variant
If Target.Columns.Count = 16 Then
Application.EnableEvents = False

With ThisWorkbook
If .Sheets("Venue").Range("AA2").Value = .Sheets("Venue").Range("AG3").Value Then
   .Sheets("Venue").Range("Z5:Z44").Value = Sheets("Venue").Range("AA5:AA44").Value
   
Else
   
    If [A1].Value = MyMarket Then
        GoTo Xit
    Else
        MyMarket = [A1].Value
        .Sheets("Venue").Range("Z5:Z44").Value = ""
        .Sheets("Venue").Range("Z5:Z44").Value = Sheets("Venue").Range("AA5:AA44").Value
    End If
   
End If
End With

Xit:
Application.EnableEvents = True
End If
End Sub
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Postby Shaun » Sun Sep 26, 2010 3:40 am

If i wanted to use the sheet code instead of a sheet name is this the correct way to do it.

Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
Static MyMarket As Variant
If Target.Columns.Count = 16 Then
Application.EnableEvents = False
With ThisWorkbook
If Sheet11.Range("AA2").Value = Sheet11.Range("AG3").Value Then
   Sheet11.Range("Z5:Z44").Value = Sheet11.Range("AA5:AA44").Value
   
Else
   
    If Sheet11.Range("A1").Value = MyMarket Then
        GoTo Xit
    Else
        MyMarket = Sheet11.Range("A1").Value
        Sheet11.Range("Z5:Z44").Value = ""
        Sheet11.Range("Z5:Z44").Value = Sheet11.Range("AA5:AA44").Value
    End If
    End If
End With
Xit:
Application.EnableEvents = True
End If
End Sub
Shaun
 
Posts: 435
Joined: Fri May 09, 2008 11:11 pm
Location: Kellerberrin, Western Australia

Previous

Return to Help

Who is online

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