Advice with using Application.OnTime function

JeffGrant

Well-known Member
Joined
Apr 7, 2021
Messages
558
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I use Application.OnTime quite a bit now and generally structure it such that the OnTime value is read from a column and then the row number is incremented to read the next time value. Generally works ok, but I have a situation where this increment method just wont be play nice.

So I am thinking about running the OnTime method through a loop and set up all of the OnTime calls in one go first thing in the morning.

This could easily be up to 100 OnTime calls during the week and up to 200 on a weekend.

Is there any reason that you folk know why this would not be advisable?

Thanks in advance
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I suppose it depends on what you're actually doing, and how you code this mechanism, but I suspect this approach might cause you more headaches than it's worth.

If Excel is busy or you're using it in some way when the OnTime callback is executed, you'll get an error message that you'll need to deal with before you can continue using Excel. My suggestion would be to explore the possibility of using VBScript (which is a subset of VBA that you can run outside of Excel) that is scheduled to execute at certain times via TaskScheduler.

Again, it all depends on what you're doing and why, but my gut instinct is that there are more useful solutions than a blanket reliance on OnTime.
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top