title: Excel VBA Check if time is between two time values, including midnight spans
body: <p>I've come into a problem that I am really struggling to find the solution to.  I have 3 time values (without the date component) stored as strings, e.g. 01:00. Two of these values represent an after and before time, and the other is the current time.  I need to check if the current time is between the after and before times (inclusive).</p>
  <p>This can simple be checked with the below:</p>
  <pre><code>Dim res As Boolean
  res = TimeValue(tVal) &gt;= TimeValue(tAfter) And TimeValue(tVal) &lt;= TimeValue(tBefore)
  </code></pre>
  <p>This works for time values that do not span midnight.  If for example you have an after time of 23:00, a before time of 04:00 and a current time of 02:00, this will not work.</p>
  <p>How do you check if a time is between two time values that span midnight? Or even how do you check if the two time values actually span midnight (as checking if the before or after times are &lt;/&gt; 00:00 doesn't seem to work either)?</p>