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

JeffGrant

Well-known Member
Joined
Apr 7, 2021
Messages
558
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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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