Set an If statement on a cell depending on the time frame
<p>I'm new here and currently I got an assignment in building up a Macro in Excel using VB. This is the logic I set up for a current cell:</p>

<pre><code>Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("B:B")) Is Nothing Then

Range("D" &amp; Target.Row) = Date

Range("E" &amp; Target.Row) = Format(Now, "hh:mm:ss")

End If

End Sub
</code></pre>

<p>Every time someone enters information inside a cell in row B, it will automatically get the date and hour (kind of a log) when is entered. What I need is depending on the time frame I get on cell E, I need to get the shift that the information was computed based on the time frame from cell E into a different row.</p>

<ul>
<li>Shift 1 = 6:30am-2:30pm </li>
<li>Shift 2 = 2:30pm - 11:30pm </li>
<li>Shift 3 = 11:30pm - 6:30am</li>
</ul>

<p>Any suggestions?</p>