Worksheet_calculate

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

Moderator: 2020vision

Worksheet_calculate

Postby GustavW » Wed Jul 28, 2010 2:46 pm

I have written a macro that is supposed to trade. I put the code under the Worksheet_calculate method. Will this run the code every time the excel spreadsheet opens? Or should I name the macro Auto_Open?

Also, on the first row of the code I check if the timer-cell is 00:00:00, and if it is, the program should move to the next race in the quickpick-list.
The code is:

If Sheet1.Cells(2, 4) = "00:00:00" Then
Sheet1.Cells(2, 17) = "-1"
End If

where the Sheet1.Cells(2, 4) is the timer-cell, and Sheet1.Cells(2, 17) is the special trigger-cell (I think).
Am I stupid to think this is going to work? Should I declare the content of the timer-cell as a string (I really don't need to handle them as numbers)?
GustavW
 
Posts: 2
Joined: Tue Jun 15, 2010 9:13 pm

Postby osknows » Wed Jul 28, 2010 9:45 pm

Hello GustavW,

The Worksheet_Calculate event is fired when a cell formula is
calculated or re-calculated or any cell values which affect the calculation
changes.

Most BA scripts use the Worksheet_Change event which fires when any cell changes. Place both of these in the SHEET object

For code to run when the workbook opens place the event Workbook_Open in the THISWORKBOOK object

In terms of cell values, it depends what you need to do with the cells but for your example it's ok to treat the cells as numbers.

If Sheet1.Cells(2, 4) = 0 Then
Sheet1.Cells(2, 17) = -1
End If

Normally variables are DIMensioned with type but your referencing objects (cells) which are defined in the cell itself. Eg if cell D2 is a string then '00:00:00 = "00:00:00" but in BA's case it's a number formatted as hh:mm:ss so 00:00:00 = 0

Hope that makes sense?
Os
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am


Return to Find an Excel developer

Who is online

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

cron