Checking the time.

StevenD

Active Member
Joined
Nov 17, 2004
Messages
262
Hi,

I have the following code.

Code:
If Time < #1:18:59 PM# And Time >#1:20:01 PM# Then
runonce = 1
End If
If runonce = 0 Then
If Time < #1:19:00 PM# And Time >#1:20:00 PM# Then
runonce = 1
'Do work at this point
End If

The code works fine, but where do i put it so that it will be checked every 30 seconds or continuosly?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Thanks Sitaram,

I'm unsure where to place the top three lines?
Code:
Public RunWhen As Double
Public Const cRunIntervalSeconds = 120    ' two minutes
Public Const cRunWhat = "The_Sub"
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,656
Members
449,091
Latest member
peppernaut

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