Excel VB help needed

Please post any questions regarding the program here.

Moderator: 2020vision

Excel VB help needed

Postby 100%beef » Sat Sep 09, 2006 6:30 pm

Hi all

Can some one help me with this.

I want to increase my stake by a percentage on each new race, not beeing good at VB how would i do this in the code?

For example the stake starts at 100, then when the next market loads I want the stake to increase by X%.

For example if I wanted to increase by 3% each time, I guess that I would have to save the current stake as a value, when the next market loads mulitply the current stake by 1.03 to get the new stake, and then save the new stake as a new value ready for the next market load.

Does that make sense? :?

:D

Many thanks!
Work facinates me I can stare at it for hours.
100%beef
 
Posts: 9
Joined: Fri Dec 02, 2005 10:55 am

Postby Mitch » Sun Sep 10, 2006 12:33 am

What you've said sounds about right. You'd also have to find a way to tell when the next race has loaded - I have the market name stored somewhere and check when A1 doesn't match it.

Do you have formulas in your stake column that could use the value in the cell storing the increased stake?

Do you have any vb running on your sheet at the moment or is it all formulas?
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Postby 100%beef » Sun Sep 10, 2006 7:48 am

Hi Mitch

Currently I have some VB to clear the matched colunms , which I got from this site, my tiggering is done with a simple formula.

Current VB is

Private Sub Worksheet_Calculate()
Static MyMarket As Variant
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
If [A1].Value = MyMarket Then
GoTo Xit
Else
MyMarket = [A1].Value
Range(Cells(5, 17), Cells(100, 20)).Value = ""
End If
Xit:
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub


I understand the flow of the code above and that this looks for a change in the A1 value, however I'm not sure where to add in the code to store my stake at the start of the day and then how to increase it by x percent.
Work facinates me I can stare at it for hours.
100%beef
 
Posts: 9
Joined: Fri Dec 02, 2005 10:55 am

Postby GeorgeUK » Sun Sep 10, 2006 8:51 am

You'll need to check this as i've just glanced at the code, but something like the below should do

Range(Cells(5, 17), Cells(100, 20)).Value = ""
'range("A21") = stake
x = range("A21")
x = x * 1.03
previously known as Gaseous (on the betfair forum)
User avatar
GeorgeUK
 
Posts: 315
Joined: Sat Nov 19, 2005 10:18 pm
Location: Scotland

Postby 100%beef » Sun Sep 10, 2006 11:49 am

Thanks George I will check it out
Work facinates me I can stare at it for hours.
100%beef
 
Posts: 9
Joined: Fri Dec 02, 2005 10:55 am

Postby Mitch » Sun Sep 10, 2006 5:30 pm

An alternative could be (after you've typed your original stake in A21, and your stake formula uses this cell)....

On the line after: Range(Cells(5, 17), Cells(100, 20)).Value = ""

Have: Range("A21")=WorksheetFunction.Round(Range("A21") * 1.03, 2)

Which will round the new stake to 2dp. If you only want to bet in whole £'s change the 2 at the end to 0.
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester


Return to Help

Who is online

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