Measuring Time in a user form syntax

M

Martha

Hi,
I'm stuck - I have a variable Starttime that I want to
check against Now(). If more than "00::02:30" elapses I
want to do something.

If Now-Starttime > "00:02:30" then
do something
end if

What would the proper syntax be?

TIA

Martha
 
B

Bob Phillips

Time is held as a fraction of one days, so 2:30 is 2.5 hours or 2.5/24. So
just use

If Now - StartTime > (2.5/24) Then
...

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
M

Martha

Thanks a bunch Bob,

I meant 2 1/2 minutes but the concept works like a
charm!!!
Thanks again,

MArtha
 
B

Bob Phillips

And that is what you showed, my mistake. Glad it helped though.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top