![]() |
time
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 a1a2 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 |
time
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) -- Gary''s Student - gsnu2007a "RobcPettit" wrote: 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 a1a2 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 |
time
ah yes, hadnt thought of that, cheers. How to you make sure its am/pm.
regards robert |
time
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 -- Gary''s Student - gsnu2007a "RobcPettit" wrote: ah yes, hadnt thought of that, cheers. How to you make sure its am/pm. regards robert |
All times are GMT +1. The time now is 03:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com