Welcome to the Bet Angel Professional Community
Example spreadsheets and comments on example spreadsheets.
by nigelk » Sat Apr 23, 2011 9:53 pm
It can only be one of two things really
Either you have no formulas in your worksheet (unlikely), or it's the conditions not being met that's stopping it.
Put this in
Private Sub Worksheet_Calculate()
Dim i As Integer
For i = 9 To 67 Step 2
Range("O" & i).ClearContents
Next i
End Sub
now put anything in O9 and then in another cell put a calculation: =2 will do
O9 should now be clear?
-

nigelk
-
- Posts: 176
- Joined: Wed Apr 15, 2009 11:00 pm
by JacoboPolavieja » Sun Apr 24, 2011 11:48 am
Hi nigelk,
Thanks for taking the time helping me out with this.
I did what you recommended with the same effect... it works as expected if I hitthe "play" button from the VBA interface, but doesn't automatically behave like that without my interaction.
The condition are met as the only condition I have is O9, O11, etc having the word "FAILED" which it clears correctly when run manually...
Pretty weird thing. I'm using Excel 2010 and I've put this in a book with macros enabled. Any other idea on how to determine where this may be coming from?
Thank you. Cheers!
-

JacoboPolavieja
-
- Posts: 91
- Joined: Thu Sep 10, 2009 6:00 pm
by nigelk » Sun Apr 24, 2011 12:52 pm
It is the sheet, not a module?
-

nigelk
-
- Posts: 176
- Joined: Wed Apr 15, 2009 11:00 pm
by JacoboPolavieja » Sun Apr 24, 2011 1:45 pm
nigelk wrote:It is the sheet, not a module?
Yep! I've put it in the exact sheet, in the Worksheet... nothing happens automatically.
I've tried to look for anything regarding automatically running macros, but it all seems normal.
Thanks a lot!
-

JacoboPolavieja
-
- Posts: 91
- Joined: Thu Sep 10, 2009 6:00 pm
by JacoboPolavieja » Sun Apr 24, 2011 8:32 pm
I really don't get it...
After thinking for a while I thought it could be an issue with the security settings for macros. I went to the Excel's "Trust Center" and enabled everything (which I know is a risk). Still... all goes fine when run manually but it does nothing if I write on a cell it should automatically clear.
I hate these things! It has to be a silly one but I can't find it!
Just needed to speak out the desperation... hehe!
-

JacoboPolavieja
-
- Posts: 91
- Joined: Thu Sep 10, 2009 6:00 pm
by nigelk » Sun Apr 24, 2011 8:43 pm
Have you got a) any disable events in your routine?
b) any error trapping routines that have
not been re-set.
c) does it call any other routines?
-

nigelk
-
- Posts: 176
- Joined: Wed Apr 15, 2009 11:00 pm
by JacoboPolavieja » Mon Apr 25, 2011 5:33 am
To summarize the exact steps of what I'm doing:
1. Create a new Excel workbook
2. Press Alt+F11 to enter VBA.
3. Right click on the name of my sheet -> view code
4. Paste the code you put.
5. Save it.
6. Close and reopen the workbook (just in case...).
7. Write something in the fields from O9 to O17: nothing happens.
8. Enter VBA and manually run de macro: it clears out the O9 - O17 cells as expected.
Maybe I need to trigger an event for the macro to run... or should it automatically run everytime a cell is changed as I expect?
Thank you so much!
-

JacoboPolavieja
-
- Posts: 91
- Joined: Thu Sep 10, 2009 6:00 pm
by nigelk » Mon Apr 25, 2011 9:28 am
There are two reasons why it won't work.
It's a Calculate event not a change event, so putting anything a cell won't cause it to fire. It has to be preceded with an = sign.
Also the cells in question are formatted as text, so even if you do put a calculation in there, nothing will happen.
Put something in O9, and then in M9 put =K9, the O9 will clear.
NB. Formatting is generally for our benefit only,if you need a date who wants to see 40658 in a cell? Much better if we see 25/04/11. If a cell is formatted as text Excel will treat it as, well text, and not a number or calculation to be acted upon.
-

nigelk
-
- Posts: 176
- Joined: Wed Apr 15, 2009 11:00 pm
by JacoboPolavieja » Mon Apr 25, 2011 11:07 am
nigelk wrote:There are two reasons why it won't work.
It's a Calculate event not a change event, so putting anything a cell won't cause it to fire. It has to be preceded with an = sign.
Also the cells in question are formatted as text, so even if you do put a calculation in there, nothing will happen.
Put something in O9, and then in M9 put =K9, the O9 will clear.
NB. Formatting is generally for our benefit only,if you need a date who wants to see 40658 in a cell? Much better if we see 25/04/11. If a cell is formatted as text Excel will treat it as, well text, and not a number or calculation to be acted upon.
Ooooooh god, it's finally working!
I didn't get that it was a calculate event only. I have the cells as "General".
My question is... will this be triggered by changes made in the sheet by BetAngel? Because the end of all this was to clear the specific cells when they showed "FAILED" or "ERROR" in order to make sure it places a bet.
Thanks a lot for your infinite patience nigelk!
P.S: I won't like to try it out with a real situation as I don't want it to start firing lots of bets without control.
-

JacoboPolavieja
-
- Posts: 91
- Joined: Thu Sep 10, 2009 6:00 pm
by nigelk » Mon Apr 25, 2011 1:18 pm
The easiest way to find out is to put this line in at the beginning or end
Msgbox "Calculation"
Then you'll see if a calculation been carried out. Obviously, take it when you are happy with what you are trying to do.
-

nigelk
-
- Posts: 176
- Joined: Wed Apr 15, 2009 11:00 pm
Return to Bet Angel - Example spreadsheets
Who is online
Users browsing this forum: contra and 1 guest