How is time represented? How do i make an equation representing 5 minutes?

  • Thread starter Thread starter R
  • Start date Start date
R

R

Fist off, big thanks to Chip Pearson who answered my last querry here
with a pointer to his site-- great stuff there, thanks!

Here is my next problem-- simple I am sure, but i haven't a clue...

In Cell e1 I have a time, in one of the standard time formats. I need
to run some code if the current time is at least 5 minutes later than
the time in e1.

The IF, THEN statement seems obvious enough, but what goes in the
place of the question marks below? Does each numeral equal a second,
so for 5 minutes it would be 60*5, or 300? Apparently not, 300 doesn't
= 5 minutes I have fingured out through trial and error.... So what
should go in place of the question marks below to equal 5 minutes??
Arggg!!!! Thanks in advance for the help and/or explanation!

If (Now() > (e1 + ????)) Then
 
Hi R,

1 Day = 24 Hours
1 Hour = 60 Mins

Therefore:

5 Mins = (1/24/60)*5
 
Hmmm, thanks Norman, but maybe I am missing something!

When I plug that in, or (.003472222) the If, THEN doesn't work at all.
If in E1 I have "Oct 7, 2004 11:10 pm" and I use:

If (Now() > (e1 + (.003472222)) Then Do xyz

It will do xyz even if the time NOW() = "Oct 7, 2004 11:12"

I need it to only do xyz if the time is 5 minutes later than E1, or
AFTER "Oct 7, 2004 11:15 pm" in this example....

Sorry if I am thick trying to figure this out, I am pretty new to VBA
and am honsetly kind of lost here.
 
Hi R,

In VBA. try:

If Now > Range("E1").Value + TimeSerial(0, 5, 0) Then
 
Wow!!! Perfect!! Thanks so much Norman-- really mega thanks, you have
no idea how much i appreciate your help! It works, it works!! YEAH!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top