excel - How to compare time using vba -


i have date value in cell (let's a1) , want check using vba whether time of date greater or smaller specific time (let's 13 hrs). how can that? tried:

if cells(1,1)<timevalue("13:00:00") 'something end if 

but didn't work.
also, if want time difference, example want know difference between 13:00:00 , 13:10:00 (which 10 minutes), how can it?

if timevalue(cells(1, 1).value) < timevalue("13:00:00")  

should work.


Comments