ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro clash (https://www.excelbanter.com/excel-programming/360033-macro-clash.html)

bondcrash[_20_]

macro clash
 

Hi all,

I have this problem on which I am kind of stuck. I have an on-time
macro (say "A") that runs every five seconds and basically download a
data series, item by item. In that five seconds period in between runs,
another macros ("B") may need to run using the last item downloaded.
However what happens is that "B" doesnt run as the macro "A" is still
engaged until the next download and therefore stops "B" from running.

Ideally there must be a way the turn the "on time" into a series of
one-shot on-times (i.e. a series of single download macros basically ).


Any suggestion appreciated!!

Best
BC


--
bondcrash
------------------------------------------------------------------------
bondcrash's Profile: http://www.excelforum.com/member.php...o&userid=20997
View this thread: http://www.excelforum.com/showthread...hreadid=537175


Tom Ogilvy

macro clash
 
Ontime already works as you desire - if it takes the macro more than the
allotted time to finish, then you will have the problem you describe. Just
like two objects can't occupy the same space, two macros can't run at the
same time. You will have to change your interval to allow both macros to
run.

--
Regards,
Tom Ogilvy


"bondcrash" wrote:


Hi all,

I have this problem on which I am kind of stuck. I have an on-time
macro (say "A") that runs every five seconds and basically download a
data series, item by item. In that five seconds period in between runs,
another macros ("B") may need to run using the last item downloaded.
However what happens is that "B" doesnt run as the macro "A" is still
engaged until the next download and therefore stops "B" from running.

Ideally there must be a way the turn the "on time" into a series of
one-shot on-times (i.e. a series of single download macros basically ).


Any suggestion appreciated!!

Best
BC


--
bondcrash
------------------------------------------------------------------------
bondcrash's Profile: http://www.excelforum.com/member.php...o&userid=20997
View this thread: http://www.excelforum.com/showthread...hreadid=537175



Bob Phillips[_6_]

macro clash
 
I would suggest changing the re-launch code of A and B to re-launch each
other. It might mean that A doesn't run every 5 seconds, but it will give
better control.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"bondcrash" wrote
in message ...

Hi all,

I have this problem on which I am kind of stuck. I have an on-time
macro (say "A") that runs every five seconds and basically download a
data series, item by item. In that five seconds period in between runs,
another macros ("B") may need to run using the last item downloaded.
However what happens is that "B" doesnt run as the macro "A" is still
engaged until the next download and therefore stops "B" from running.

Ideally there must be a way the turn the "on time" into a series of
one-shot on-times (i.e. a series of single download macros basically ).


Any suggestion appreciated!!

Best
BC


--
bondcrash
------------------------------------------------------------------------
bondcrash's Profile:

http://www.excelforum.com/member.php...o&userid=20997
View this thread: http://www.excelforum.com/showthread...hreadid=537175




bondcrash[_21_]

macro clash
 

Tom,

the macro "A" takes a fraction of a second to run - the "B" can b
several of them but no more than one at a time and those take
fraction of a second to run as well. I think 5 secs is more than enoug
to allow "B" to run. The problem, as I see it, is that the on-time macr
"A" is on all the time, even in between the five seconds event since i
waits for the next run, and I think "B" is not allowed to run until
"A" is done but being an on-time means never... (or until i stop it).

I may run some individual macro's each to do the task and say print
time on the sheet and whenever there are more than five secs re-run i
etc but the problem is in that case I need to have the time functio
continuously going and I need an outside source for that becaus
otherwise the time is updated only at recalculation. Basically I am
bit stuck.

Thanks for the suggestion Bob but basically I have several of them an
have no way to know which one/if any of the "B" will get triggered b
the latest download of "A" (I am basically back-testing a series an
see if it generates a signal).

Cheers guys
B

--
bondcras
-----------------------------------------------------------------------
bondcrash's Profile: http://www.excelforum.com/member.php...fo&userid=2099
View this thread: http://www.excelforum.com/showthread.php?threadid=53717


Tom Ogilvy

macro clash
 
No, that isn't how Ontime works at all. It isn't on all the time. If fires
the macro and ends. If excel is busy, it won't fire the macro as it is not
preemptive. Depending on how you configure it, it can be allowed to try
again. See the help for details.

See Chip Pearson's page on ontime for some examples.

http://www.cpearson.com/excel/ontime.htm

--
Regards,
Tom Ogilvy


"bondcrash" wrote:


Tom,

the macro "A" takes a fraction of a second to run - the "B" can be
several of them but no more than one at a time and those take a
fraction of a second to run as well. I think 5 secs is more than enough
to allow "B" to run. The problem, as I see it, is that the on-time macro
"A" is on all the time, even in between the five seconds event since it
waits for the next run, and I think "B" is not allowed to run untill
"A" is done but being an on-time means never... (or until i stop it).

I may run some individual macro's each to do the task and say print a
time on the sheet and whenever there are more than five secs re-run it
etc but the problem is in that case I need to have the time function
continuously going and I need an outside source for that because
otherwise the time is updated only at recalculation. Basically I am a
bit stuck.

Thanks for the suggestion Bob but basically I have several of them and
have no way to know which one/if any of the "B" will get triggered by
the latest download of "A" (I am basically back-testing a series and
see if it generates a signal).

Cheers guys
BC


--
bondcrash
------------------------------------------------------------------------
bondcrash's Profile: http://www.excelforum.com/member.php...o&userid=20997
View this thread: http://www.excelforum.com/showthread...hreadid=537175



bondcrash[_22_]

macro clash
 

cheers Tom

B

--
bondcras
-----------------------------------------------------------------------
bondcrash's Profile: http://www.excelforum.com/member.php...fo&userid=2099
View this thread: http://www.excelforum.com/showthread.php?threadid=53717



All times are GMT +1. The time now is 08:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com