How to compare time using Excel VBA
<p>I have a date value in a cell (let's say <code>A1</code>) and I want to check using VBA whether the time of that date is greater or smaller than a specific time (let's say 13 hrs). How can I do that? I tried:</p>

<pre><code>if Cells(1,1)&lt;TimeValue("13:00:00") then
'Something
end if
</code></pre>

<p>But that didn't work.  </p>

<p>Also, if I want to get a time difference, for example I want to know the difference between 13:00:00 and 13:10:00 (which is 10 minutes), how can I do it?</p>