Auto clearing status cells
I spoke to soon! All sorts of problems appeared on a live test. I'd hoped to embed my own sub-routine into the periodic update macro - but it failed dismally. However, I reproduced a Calculate worksheet that I found on another search of the forum, which did the trick of automatically clearing the status cells once the market has been suspended. Testing went OK yesterday evening.
Whilst I'm still running a system in 'beta' mode (real money, but small stakes), I'm happy to deliberately not clear cells. BetAngel's refusal to let me stake twice if I don't clear the cells has saved me a few timesTheTub wrote:How did you crack it?
I would use practice mode to start with. Auto-clearing status cells can result in hundreds of bets being placed in a very short space of time if you are not careful.
Hi.
Anyone have come up with an solution?
Thanks
I'm having the same issue.I've got the spreadsheet working (IE, it clears the cells when I click the Start button) but it doesn't continue to clear every 10 seconds thereafter.
Is this what it is supposed to do? Am I getting something wrong?
Anyone have come up with an solution?
Thanks
Hello.
I downloaded the spreadsheet that auto clears the cells yesterday and was planning to trial it today.
I know you are aware of this but is has probably slipped your mind, I am one of, I suspect, many people that are not able to sit and watch the markets but HAVE to rely on automation.
As soon as I open an unrelated worksheet I get "subscript out of range". When I go into the debugger the problem is
Worksheets("Sheet2").Range("a4") = 1
I can muddle my way through visual basic but I don't know enough to correct it. It appears that the routine is applying to the whole of Excel rather that the specific workbook.
Thanks.
I downloaded the spreadsheet that auto clears the cells yesterday and was planning to trial it today.
I know you are aware of this but is has probably slipped your mind, I am one of, I suspect, many people that are not able to sit and watch the markets but HAVE to rely on automation.
As soon as I open an unrelated worksheet I get "subscript out of range". When I go into the debugger the problem is
Worksheets("Sheet2").Range("a4") = 1
I can muddle my way through visual basic but I don't know enough to correct it. It appears that the routine is applying to the whole of Excel rather that the specific workbook.
Thanks.
If you have 2 or more workbooks open vba gets a bit confused as to which workbook you are referring to.
It's likely that the code refers only to its own workbook, which hasn't got a sheet named "Sheet2".
You'll need to fully qualify each reference to each workbook.
If I have 1 workbook open, Twb and Owb will give the same result. If I have 2 workbooks open, and the 2nd is the ACTIVE (the one you are looking at), Owb will return a different name.
This can refer to either workbook, (but will fail if it can't find a sheet named sheet1.)
This will always refer to the workbook in which the code resides.(Again will fail if no sheet named sheet1).
It's likely that the code refers only to its own workbook, which hasn't got a sheet named "Sheet2".
You'll need to fully qualify each reference to each workbook.
If I have 1 workbook open, Twb and Owb will give the same result. If I have 2 workbooks open, and the 2nd is the ACTIVE (the one you are looking at), Owb will return a different name.
Code: Select all
Sub test()
Dim Twb As Workbook, Owb As Workbook
Set Twb = ThisWorkbook
Set Owb = ActiveWorkbook
MsgBox Owb.Name
End Sub
Code: Select all
Owb.Sheets("Sheet1").Range("A2") = "1"
Code: Select all
Twb.Sheets("Sheet1").Range("A2") = "1"
-
- Posts: 6
- Joined: Tue Nov 22, 2016 10:15 am
Hi Everyone,
The attached file works for me however I'd like to use this with multiple sheets. Does anyone have a worksheet clearing status cells on multiple sheets? Or a work around? I want to bet on many races per day and clear the status cells every 60 seconds.
Any help would be greatly appreciated.
Cheers,
Andrew
The attached file works for me however I'd like to use this with multiple sheets. Does anyone have a worksheet clearing status cells on multiple sheets? Or a work around? I want to bet on many races per day and clear the status cells every 60 seconds.
Any help would be greatly appreciated.
Cheers,
Andrew
You do not have the required permissions to view the files attached to this post.
This will clear all status cells on any sheets beginning with the name "Bet Angel"
Note that since there are multiple sheets the formula in J2 in not relevant as it only points to 1 sheet.
Edit. Posted wrong sheet. Below is correct.
Note that since there are multiple sheets the formula in J2 in not relevant as it only points to 1 sheet.
Edit. Posted wrong sheet. Below is correct.
You do not have the required permissions to view the files attached to this post.
We all have specific requirements for when we want to clear status. So rather than wait for others to give you a part solution build something yourself. Write conditional statments based on spreadsheet data within a worksheet_calculate event. This allows you to trigger a cleardown when you define. This built in function is called whenever a formula calculation is triggered. So in a single cell have a formula which sums up the countdown,odds and unmatched money. This will ensure continous streaming of triggers on any key change anywhere from miliseconds to a second.
Secondly, to avoid unwanted bets when clearing status, also clear down one of the other fields i.e. stake or bet command.
Thirdly, for multi-spreadSheet always uss me.cells commands rather than sheet1.cells (sheet2..3..4..5 etc). This allows you to copy/replicate the sheet with the code and it will.work in each specific sheet.
Secondly, to avoid unwanted bets when clearing status, also clear down one of the other fields i.e. stake or bet command.
Thirdly, for multi-spreadSheet always uss me.cells commands rather than sheet1.cells (sheet2..3..4..5 etc). This allows you to copy/replicate the sheet with the code and it will.work in each specific sheet.
-
- Posts: 2
- Joined: Wed Apr 12, 2017 11:06 am
Also having the same issue. Any solution?alto wrote: ↑Sun Jul 21, 2013 8:26 pmHi.
I'm having the same issue.I've got the spreadsheet working (IE, it clears the cells when I click the Start button) but it doesn't continue to clear every 10 seconds thereafter.
Is this what it is supposed to do? Am I getting something wrong?
Anyone have come up with an solution?
Thanks
In H4 the countdown timer is converted into seconds.
In I4 the mod function divides by ten for your 10 second timer.
J4 will increase by 1 each time when the divisor is zero.
Note: A 1/2 second delay (sleep 500) has been added to stop the routine sometimes firing twice. Depending to the complexity of your code and how long it takes to run, I would imagine that this could be removed if required, but haven't tried it.
Replace the "Range("j4") = Range("j4") + 1" code with your clear status subroutine
Cheers,Nigel.
In I4 the mod function divides by ten for your 10 second timer.
J4 will increase by 1 each time when the divisor is zero.
Note: A 1/2 second delay (sleep 500) has been added to stop the routine sometimes firing twice. Depending to the complexity of your code and how long it takes to run, I would imagine that this could be removed if required, but haven't tried it.
Replace the "Range("j4") = Range("j4") + 1" code with your clear status subroutine
Cheers,Nigel.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 575
- Joined: Wed Apr 19, 2017 5:12 pm
- Location: Wolverhampton
Good evening gents,
I thought I'd ask the question in this thread to keep everything tidy and relevant. Would anybody be kind enough to spare a code for clearing the status cell, instead of going be a timer has anybody done it using the worksheet_change function using VBA?
My strategy will require quite quickly clearing cells you see. Because of this though, I have another problem. If for example I put the following in cells L9, M9 and N9:
BACK, 4.0, 2
But then my formula changes L9 from BACK to " " before the bet has had chance to be placed, I get left with 'OK' or even just 'ERROR'. Is there a way, again using VBA (perhaps intertwined with the clear status worksheet_change function) that I can have a spreadsheet keep the order in the instruction field long enough for it to go through?
Extra info:
BACK Triggers - D31:D36 (For 6 seperate runners)
LAY Trigger - E31:E36 (Ditto)
BACK CLOSE Trigger - F31:F36 (And again)
LAY CLOSE Trigger - G31:G36 (You guessed it!)
So to reiterate, Cell D31 says "BACK" for horse 1 but can change quickly (before the order hits the market) and then after it's been placed, I'd like to immediately clear the status cell please. I have precautions in place with the triggers to avoid multiple bets firing in already. If anybody could be so kind as to share some code or point me in the right direction it would massively help me out.
Cheers lads!
Callum
I thought I'd ask the question in this thread to keep everything tidy and relevant. Would anybody be kind enough to spare a code for clearing the status cell, instead of going be a timer has anybody done it using the worksheet_change function using VBA?
My strategy will require quite quickly clearing cells you see. Because of this though, I have another problem. If for example I put the following in cells L9, M9 and N9:
BACK, 4.0, 2
But then my formula changes L9 from BACK to " " before the bet has had chance to be placed, I get left with 'OK' or even just 'ERROR'. Is there a way, again using VBA (perhaps intertwined with the clear status worksheet_change function) that I can have a spreadsheet keep the order in the instruction field long enough for it to go through?
Extra info:
BACK Triggers - D31:D36 (For 6 seperate runners)
LAY Trigger - E31:E36 (Ditto)
BACK CLOSE Trigger - F31:F36 (And again)
LAY CLOSE Trigger - G31:G36 (You guessed it!)
So to reiterate, Cell D31 says "BACK" for horse 1 but can change quickly (before the order hits the market) and then after it's been placed, I'd like to immediately clear the status cell please. I have precautions in place with the triggers to avoid multiple bets firing in already. If anybody could be so kind as to share some code or point me in the right direction it would massively help me out.
Cheers lads!
Callum