Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare data formatted as hh:mm

Status
Not open for further replies.

neepshed

IS-IT--Management
Aug 17, 2002
27
0
0
GB
Hello, I have a script that compares data formatted as hh:mm.
However the comparison never seems to work.

FromTime is defined as a Long.

If ToSheet.Cells(2, 3) = FromTime Then
FoundTime = True
Cells(YrRow, TimeCol).Interior.ColorIndex =3

End If

Any thoughts?
 
Internally, time is stored as a fraction of a day. At a guess, from time is in minutes. If that is the case, either convert the cell to minutes or convert ToTime to a fraction of a day. eg to convert to minutes
Code:
when = ToSheet.Cells(2, 3)
when = int((when - int(when))*1440)
if when = ToTime then
    ....
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top