Hello,
Is it possible to do an if/else statement based on the computer’s current time?
For example:
— If the time is after 6PM, then select the data below and copy (but only copy if it’s past 6PM)
Hello,
Is it possible to do an if/else statement based on the computer’s current time?
For example:
— If the time is after 6PM, then select the data below and copy (but only copy if it’s past 6PM)
Hi Gabriel,
I would recommend a .Net method called DateTime.Now, This will give you the exact time and date at the time of execution. There are lots of methods and fields on a DateTime object, but DateTime.Hour will give you the number of hours into the day it currently is.
I’d use " DateTime.Now.Hour " in an if statement to make this kind of decision. You can find more documentation on it here; this resource refers to C# but it works almost exactly the same in VB.
Best,
Evan
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.