Do Hourly_Work every hour 10 minutes 30 seconds after the hour.

MrRRice

New Member
Joined
Jun 22, 2022
Messages
1
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello,

So I have my excel opening and running:

Private Sub Workbook_Open()
Call Start_Up
End Sub


In Start_up I have:

Sub Start_Up()
Dim x_minute As Integer
Dim y_minute As Integer
Dim wait_time As String

x_minute = Minute(Now())

If x_minute < 10 Then
y_minute = 10 - x_minute
wait_time = "00:0" & CStr(y_minute) & ":00"
Application.Wait (Now + TimeValue(wait_time))
Call Hourly_Work
Call Scheduler
Else
Call Hourly_Work
Call Scheduler
End If

End Sub


It will call the Hourly_Work and do the work just fine. The issue is what do I put in the Scheduler to have it run every hour but 10 minutes and 30 seconds after the hour? On the internet I can find several ways to do a loop every hour and that would be to place Application.OnTime Now + TimeValue("01:00:00"), "Hourly_Work" inside Hourly_Work at the end of it. The issue though is I need it to be 10 minutes 30 seconds after the hour that way the RTUs (Remote Transmitting Units) in the field have had time to communicate back to the database with the new values. Otherwise I am getting the previous hours values still. So if you have any suggestions and or help would be greatly appreciated, and thank you in advance.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Remove the 'Now' to tell it what time you want it to run.

Application.OnTime TimeValue("01:10:30"), "Hourly_Work"

That is a 24 hr time. ;) So 08:10:30 Would be 10 1/2 minutes past 8 in the morning.

Look here for more info.
 
Upvote 0

Forum statistics

Threads
1,223,937
Messages
6,175,510
Members
452,650
Latest member
Tinfish

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