Excel MAcro running high on CPU load

Please post any questions regarding the program here.

Moderator: 2020vision

Excel MAcro running high on CPU load

Postby mantas779 » Sun Feb 17, 2008 3:16 pm

I made a macro in VBA with a lot of IF THEN (11) for 1 row. When i let the macro run it works nice but uses a lot of CPU.

A made this 11 runs for 10 rows with FOR NEXT , but then EXCEL chrashes, no error message, just get stucked. and CPU is through the roof!! :shock:

How can i reduce the CPU load? :(

every sugestion is welcome. :P
mantas779
 
Posts: 103
Joined: Tue Feb 06, 2007 9:43 am
Location: the netherlands

Postby PeteB » Sun Feb 17, 2008 5:36 pm

Could your code be in an infinite loop? That would have those symptoms.

11 if/thens is not much - the CPU would barely notice them.

Maybe your for-next is looping more times than your think on the first row, and so using CPU, and looping infinitely when you add more rows?
PeteB
 
Posts: 258
Joined: Tue May 23, 2006 12:13 pm

for next

Postby mantas779 » Sun Feb 17, 2008 7:58 pm

Could be , how can i divine it , and /or see it that it is in a indifinite loop is?
mantas779
 
Posts: 103
Joined: Tue Feb 06, 2007 9:43 am
Location: the netherlands

Postby phrenetic » Sun Feb 17, 2008 8:47 pm

One thing to check, if you are CHANGING the value of any cells in your spreadsheet from within your macro, then make sure that you have called Application.EnableEvents = False before the change, and Application.EnableEvents = True after the change - otherwise your code will descend into an infinite loop very quickly!

Alistair
phrenetic
 
Posts: 142
Joined: Tue Oct 16, 2007 8:44 pm

Macro

Postby mantas779 » Sun Feb 17, 2008 10:58 pm

That was it , i had to put it in the beginning and the end of the macro.
Macro runs smooth now.

THX , you saved my weekend ! :lol:

I just started with VBA 1 moth ago , it is still all greek to me :oops:

THX again
mantas779
 
Posts: 103
Joined: Tue Feb 06, 2007 9:43 am
Location: the netherlands

macro

Postby mantas779 » Sun Feb 17, 2008 11:51 pm

Only now when it put in a order , on the end it says CANCELLED?
In betfair the orders are still there .

How can i prevent that it says CANCELLED?

My macro put inmidiate a new order in , becuase if have 1 IF THEN there is CANCELLED in that cell LAY again. so the orders start to pille up in the book :shock:

THX
mantas779
 
Posts: 103
Joined: Tue Feb 06, 2007 9:43 am
Location: the netherlands

Postby phrenetic » Mon Feb 18, 2008 10:50 am

What command are you using to specify the Lay bet?

LAY

or

LAY-Fxx

Alistair
phrenetic
 
Posts: 142
Joined: Tue Oct 16, 2007 8:44 pm

lay

Postby mantas779 » Mon Feb 18, 2008 3:10 pm

LAY-T1-F120

But there is CANCELLED immediately after it puts in the LAY bet, not after 120 sec.

Gr.
mantas779
 
Posts: 103
Joined: Tue Feb 06, 2007 9:43 am
Location: the netherlands

Postby phrenetic » Mon Feb 18, 2008 4:00 pm

Is your issue the same as highlighted in the attached postings?

http://www.gruss-software.co.uk/forum/viewtopic.php?t=1965

Alistair
phrenetic
 
Posts: 142
Joined: Tue Oct 16, 2007 8:44 pm

macro

Postby mantas779 » Mon Feb 18, 2008 4:09 pm

No, it has to doe with the macro, Application.EnableEvents = False/true
when i placed this in my macro it started. :x
Also my macro doesn't get into a infinite loop anymore :D
mantas779
 
Posts: 103
Joined: Tue Feb 06, 2007 9:43 am
Location: the netherlands

BF update

Postby mantas779 » Mon Feb 18, 2008 7:08 pm

Yes , it has to do with it, Thought it was my bad programming !!
mantas779
 
Posts: 103
Joined: Tue Feb 06, 2007 9:43 am
Location: the netherlands


Return to Help

Who is online

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