I'm trying to write a macro that will look at a series of times, compare each one with a benchmark time and then generate a note next to each compared time. When I run the macro it will do this for the first cell in the range, but not for the rest.
Cell C8 in the "ActivityData" worksheet is the benchmark time. The times to be compared start in cell F12 of the "SIS" worksheet and vary in number.
Here is the code in its entirety:
Sub TimeCalc()
Dim wb As Workbook
Dim SIS As Worksheet
Dim Act As Worksheet
Set wb = ActiveWorkbook
Set SIS = wb.Worksheets("SIS")
Set Act = wb.Worksheets("ActivityData")
'Navigate to start times
wb.Worksheets("SIS").Select
Range("f12").Select
SIS.Range(Selection, Selection.End(xlDown)).Select
'Compare start times
For Each rng In Selection
If Act.Range("C8").Value < rng.Value Then
ActiveCell.Offset(0, -1).Range("A1").Value = "Missed " & Format(Act.Range("c8").Value, "Medium time") & " - " & Format((rng.Value - 0.000694444), "Medium Time")
Else
End If
On Error Resume Next
Next rng
End Sub
Thanks for your help!