time

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

RobcPettit

Hi, Im running a macro which updates then time in Range("a1"),
(Range("a1").Value = Time). The macro goes of does its job, updating
the time at set intervals, then when conditions are met, in
Range("a2") it adds the time now + 60 minutes. In vba I want to say if
time in a1 > time in a2 then............ Ive tried simply if a1>a2
then, sometimes it works, but not always. eg at the momment in a1 I
have 12:07 and in a2 11:04. vba says a2 is the greater. Is there a
better way to do this.
Regards Robert
 
Make sure there is no AM/PM confusion. 12:07 (just after midnight) is less
than 111:04 ( just before noon)

But

12:07 (just after noon) is greater than 11:04 (before noon)
 
ah yes, hadnt thought of that, cheers. How to you make sure its am/pm.
regards robert
 
Remove the masquerade (formatting). In its raw form:

12:07:00 PM is 0.504861111111111
12:07:00 AM is 0.004861111111111
11:04:00 PM is 0.961111111111111
11:04:00 AM is 0.461111111111111
 

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