Moderator: 2020vision
by G78 » Wed Mar 06, 2019 9:46 am
by Captain Sensible » Wed Mar 06, 2019 10:34 am
by MarkRussell » Wed Mar 06, 2019 10:35 am
Private Sub Worksheet_Change(ByVal Target As Range)
IF Target.Columns.Count = 16 Then
.....put your code here......
End IF
End Sub
by G78 » Wed Mar 06, 2019 11:43 am
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("T3").Value > 100 Then
Range("Z5:Z50").ClearContents
End If
Dim KeyCells As Range
Set KeyCells = Range("V5:V20")
If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
If Range("V" & Target.Row).Value > 0 Then
Range("V" & Target.Row).Copy
Sheet1.Range("Z" & Target.Row).PasteSpecial xlPasteValues
End If
End If
Application.CutCopyMode = False
End Sub
by G78 » Wed Mar 06, 2019 11:46 am
by Captain Sensible » Wed Mar 06, 2019 2:03 pm
by G78 » Wed Mar 06, 2019 2:42 pm
by G78 » Wed Mar 06, 2019 2:45 pm
by Captain Sensible » Wed Mar 06, 2019 2:56 pm
G78 wrote:Some of that makes sense, yes. Other pats not so much, but if you could share some example code, I'd be grateful, thanks.
Strangely I was testing a moment ago and have on occasion (seemingly at random) I managed to get it to copy the matched odds.
by G78 » Wed Mar 06, 2019 2:59 pm
by Captain Sensible » Wed Mar 06, 2019 3:10 pm
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub 'If columns changed <> 16 then exit sub
Application.EnableEvents = False 'Turn off events so changes to cell don't retrigger event
If Range("T3").Value > 100 Then
Range("Z5:Z50").ClearContents
End If
Dim KeyCells As Range
Set KeyCells = Range("V5:V20")
Dim lastrow As Long, i As Long 'declare some variables
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row ' get last row of runner data for our loop
If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
For i = 5 To lastrow
If Range("V" & i).Value > 0 Then Range("Z" & i).Value = Range("V" & i).Value ' copy V to Z if V > 0
End If
Next i
End If
Application.EnableEvents = True 'Turn on events again
End Sub
by Captain Sensible » Wed Mar 06, 2019 3:12 pm
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub 'If columns changed <> 16 then exit sub
Application.EnableEvents = False 'Turn off events so changes to cell don't retrigger event
If Range("T3").Value > 100 Then
Range("Z5:Z50").ClearContents
End If
Dim KeyCells As Range
Set KeyCells = Range("V5:V20")
Dim lastrow As Long, i As Long 'declare some variables
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row ' get last row of runner data for our loop
If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
For i = 5 To lastrow
If Range("V" & i).Value > 0 Then Range("Z" & i).Value = Range("V" & i).Value ' copy V to Z if V > 0
Next i
End If
Application.EnableEvents = True 'Turn on events again
End Sub
by Captain Sensible » Wed Mar 06, 2019 3:20 pm
If Target.Columns.Count <> 16 Then Exit Sub 'If columns changed <> 16 then exit sub
by G78 » Wed Mar 06, 2019 8:08 pm
by G78 » Thu Mar 07, 2019 10:41 am
Captain Sensible wrote:Actually thinking about it you'll probably need to remove , or comment out the
- Code: Select all
If Target.Columns.Count <> 16 Then Exit Sub 'If columns changed <> 16 then exit sub
Because you're using Application.Intersect that block of data V5:V20 doesn't get updated in the data A:P that's sent in those 16 columns.
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.