VBA help anyone?

Find a developer for your Excel triggered betting needs and advertise your development service here.

Moderator: 2020vision

VBA help anyone?

Postby Toma » Tue Oct 29, 2013 5:53 pm

Guys, just wondering if anyone would know the VBA code to capture my positions at Kick Off?

I have extracted what I need into this "dashboard" but can't capture the kick off prices and financials - other than manually doing it :(

Any help very much appreciated (hope this picture works ???)
Image
Toma
 
Posts: 74
Joined: Sat Nov 19, 2005 9:06 pm
Location: Wallsend, Newcastle upon Tyne

Postby osknows » Tue Oct 29, 2013 7:30 pm

This will copy the data from pre-game columns to at kick off columns when run. As I can't see the exact row/column ids, I've assumed it starts from cell A1 so that the -£40.87 is in cell F5

Just call KickOff when you want to copy the values

MODULE:
Code: Select all
Sub KickOff()
Dim lRow As Long
Dim ws As Worksheet
Dim rngToSearch As Range
Dim dataStartRow As Long
   
    Set ws = R1
    Set rngToSearch = ws.Range("F:K")
    dataStartRow = 3
    writeDataOffsetColumns = 8
   
    lRow = LastRow(rngToSearch)
    If lRow > dataStartRow Then
        'Copies Contents of data to same row offset by 8 columns
        rngToSearch.Resize(lRow - dataStartRow, rngToSearch.Columns.Count).Offset(dataStartRow, writeDataOffsetColumns).Value _
         = rngToSearch.Resize(lRow - dataStartRow, rngToSearch.Columns.Count).Offset(dataStartRow, 0).Value
    End If
End Sub


Function LastRow(ByVal rng As Range, Optional Offset As Long) As Long
On Error GoTo blankSheetError
    'Identify next blank row
    LastRow = rng.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row + Offset

    Exit Function

blankSheetError:
    LastRow = 1 'Will produce error if blank sheet so default to row 1 as cannot have row 0
    Resume Next

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

Postby Toma » Tue Oct 29, 2013 7:42 pm

This is brilliant osknows thank you very much for this response...however, its currently coming up with "Object Required"? Sorry I'm normally ok with Excel itself but this VB stuff is a different level.

Ideally what I wanted to be able to do was use the =NOW() function to get the correct time and then check the kick off times and copy the relevant rows over as and when the games started.

Rather than actually be there to run the macro as that's half the problem I keep missing the kick offs and therefore the prices at kick off :(

Sorry mate for not explaining myself earlier but once again thank you so much for your assistance (so far) different class!

Alan
Toma
 
Posts: 74
Joined: Sat Nov 19, 2005 9:06 pm
Location: Wallsend, Newcastle upon Tyne

Postby Toma » Tue Oct 29, 2013 7:48 pm

so at this stage of the day this is how my "manually updated" spreadsheet looks now:-

Image
Toma
 
Posts: 74
Joined: Sat Nov 19, 2005 9:06 pm
Location: Wallsend, Newcastle upon Tyne

Postby osknows » Tue Oct 29, 2013 8:36 pm

What format are the kick off times in column B, are they strings '18:00 or dates formatted as hh:mm?

If you like, email it to me and I'll add the code. I'll PM my email address

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

Re: VBA help anyone?

Postby ghhtty » Fri Aug 29, 2014 12:16 pm

If you like, email it to me and I'll add the code. I'll PM my email address.
ghhtty
 
Posts: 3
Joined: Fri Aug 29, 2014 12:10 pm


Return to Find an Excel developer

Who is online

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