Getting a macro to run continuously

Please post any questions regarding the program here.

Moderator: 2020vision

Re: Getting a macro to run continuously

Postby Ferru123 » Sat Aug 05, 2017 11:41 am

Thank you.

The script works a dream when I manually type 1 into the cell I want to copy from.

The error message arises when the cell in question's value is 1 as the result of a formula being applied.

...and just for good measure, it boots me out of automatic calculation mode when it crashes ! :lol:

Any suggestions?

Jeff
Ferru123
 
Posts: 89
Joined: Sat Feb 21, 2009 1:28 pm

Re: Getting a macro to run continuously

Postby Captain Sensible » Sat Aug 05, 2017 12:15 pm

To be honest Jeff I have no idea what code you're using half the time,

just try something like this, it has error coding to hopefully catch the error and exit you at the point where it will restart you event/clacualtions. I'm away for a week later today and won't have much access to my PC but plenty of people around to help if you still can't get it working.

Code: Select all
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Static MyMarket As Variant
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
On Error Goto Xit:



If [A1].Value = MyMarket Then

For i =5 to 10
If Range("AE" & i).Value=1 then Range("AF" & i).Value=Range("AE" & i).Value
next i

GoTo Xit
Else
MyMarket = [A1].Value

Range("AF5:AF50").Value = ""
End If


Xit:

Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Re: Getting a macro to run continuously

Postby Ferru123 » Sat Aug 05, 2017 4:49 pm

Thanks Captain Sensible.

That appears to have done the trick.

I'm guessing you left out 'Dim i as integer' to see if I'd work it out for myself? :)

BTW, anyone learning how to program VBA macros to help with their automation could do a lot worse than to read this thread.

Thanks again, much appreciated.

Jeff
Ferru123
 
Posts: 89
Joined: Sat Feb 21, 2009 1:28 pm

Previous

Return to Help

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] 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.