Application.Ontime method stops when a null cell is encounterd.

JeffGrant

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

I am using

With Sheet10
TimeToRun = CDate(.Range("AH" & 2 + i).Value)
Application.OnTime TimeToRun, "myMacro"
End With

where TimeToRun is read in from a range and "i" is incremented elsewhere.

All is good until, the TimeToRun reads in a blank cell, that is set to "" from other code.

I can't find any information anywhere, but it looks as though if a null time argument is passed to Application.Ontime, then everything else just stops. Even if "i" increments passed the blank cell, the method stops.

Is this correct?

The reason I have blanks in the range that is being read, is because if I call an API within 3 minutes of the previous call, then there is no need to do it again.

Thanks for your help.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Thanks Logit. I did fix the issue by pulling out the Unique Values of Time and read through them, but I would still like to know if I am correct about the "" Time for in Application.Ontime.

cheers
 
Upvote 0

Forum statistics

Threads
1,215,606
Messages
6,125,803
Members
449,261
Latest member
Rachel812321

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