HELP! Need to copy contents of W5:W50 to AA5:AA50 ONCE

Please post any questions regarding the program here.

Moderator: 2020vision

HELP! Need to copy contents of W5:W50 to AA5:AA50 ONCE

Postby danjuma » Thu Apr 08, 2010 10:00 pm

There's probably a thread about this somewhere in the forum. I will keep looking. In the meantime, if somebody could oblige please with a code, I would be most grateful.

Many thanks
User avatar
danjuma
 
Posts: 347
Joined: Mon Apr 21, 2008 4:17 pm

Postby mak » Thu Apr 08, 2010 10:12 pm

how about this?you can modified a little and it is ready (i think ) :)

http://www.gruss-software.co.uk/forum/v ... light=copy
mak
 
Posts: 1086
Joined: Tue Jun 30, 2009 8:17 am

Postby danjuma » Thu Apr 08, 2010 10:38 pm

Thanks mak.

Did see that, but looks a bit complicated for me to understand for what I want. I managed to piece the following code together, but unfortunately, it keeps coping new data at every refresh, I want to capture the data just once. I think I need to figure out how to code/where to place the refreshCounter :? Any suggestions please?

Code: Select all
Dim refreshCount As Integer

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False
With ThisWorkbook.Sheets(Target.Worksheet.Name)
refreshCount = 0
If refreshCount = 0 Then
 Range("aa5:aa50").Value = Range("w5:w50").Value
End If
 refreshCount = refreshCount + 1
End With
Application.EnableEvents = True
End Sub
User avatar
danjuma
 
Posts: 347
Joined: Mon Apr 21, 2008 4:17 pm

Postby Captain Sensible » Fri Apr 09, 2010 1:54 pm

Problem with your current code is that it's always resetting

refreshCount = 0

at the start of the coding , so refreshCount is always 0 and the code will continue to copy.

You need to be looking at whats the criteria for triggering that 'capture' and then stick the

refreshCount = 0

within that part of the code.

When is it meant to capture?
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby danjuma » Fri Apr 09, 2010 3:40 pm

Captain Sensible wrote:Problem with your current code is that it's always resetting

refreshCount = 0

at the start of the coding , so refreshCount is always 0 and the code will continue to copy.

You need to be looking at whats the criteria for triggering that 'capture' and then stick the

refreshCount = 0

within that part of the code.

When is it meant to capture?


Hi CS,

and thanks for the reply. I basically want want it to capture when the first bets are placed. So basically capture when "sum(w5:w50)>0".
Anyway, if I can't come up with a solution, I might go about it in a round about way using "MyBets" sheet.
User avatar
danjuma
 
Posts: 347
Joined: Mon Apr 21, 2008 4:17 pm

Postby Captain Sensible » Fri Apr 09, 2010 5:19 pm

You could use something like WorksheetFunction.Sum(Range("W5:W50")) and reset the values when the market changes. You'd obviously miss any matches being logged after the first matched bet though




Dim refreshCount As Currency
Dim betCount As Currency

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False
With ThisWorkbook.Sheets(Target.Worksheet.Name)

betCount = WorksheetFunction.Sum(Range("W5:W50"))


If betCount = 0 Then
refreshCount = 0
Range("AA5:AA50").Value = ""
End If


If betCount > 0 And refreshCount < 1 Then
Range("aa5:aa50").Value = Range("w5:w50").Value
refreshCount = refreshCount + 1
End If

End With
Application.EnableEvents = True
End Sub
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby danjuma » Fri Apr 09, 2010 5:33 pm

Captain Sensible wrote:You could use something like WorksheetFunction.Sum(Range("W5:W50")) and reset the values when the market changes. You'd obviously miss any matches being logged after the first matched bet though




Dim refreshCount As Currency
Dim betCount As Currency

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False
With ThisWorkbook.Sheets(Target.Worksheet.Name)

betCount = WorksheetFunction.Sum(Range("W5:W50"))


If betCount = 0 Then
refreshCount = 0
Range("AA5:AA50").Value = ""
End If


If betCount > 0 And refreshCount < 1 Then
Range("aa5:aa50").Value = Range("w5:w50").Value
refreshCount = refreshCount + 1
End If

End With
Application.EnableEvents = True
End Sub


Many thanks for this CS. much obliged. :D

"You'd obviously miss any matches being logged after the first matched bet though" That's fine, just need to capture when the first bet(s) are placed. Cheers
User avatar
danjuma
 
Posts: 347
Joined: Mon Apr 21, 2008 4:17 pm

Postby danjuma » Fri Apr 09, 2010 5:36 pm

That's fine, just need to capture when the first bet(s) are placed.


Sorry meant matched.
User avatar
danjuma
 
Posts: 347
Joined: Mon Apr 21, 2008 4:17 pm


Return to Help

Who is online

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