Hi
I am trying to compare two lots of times and got as far as the code below. In Cells A1, A2 and A3 I have three times in the format +02'00... and in Cells B1, B2, B3 I have three times in the format 00:17:00. If the time in Column A are greater than the times in Column B I want a Yes in Columns C. but I keep seeing the times as 1.18055 for example.
<tbody>
</tbody>
Thanks
I am trying to compare two lots of times and got as far as the code below. In Cells A1, A2 and A3 I have three times in the format +02'00... and in Cells B1, B2, B3 I have three times in the format 00:17:00. If the time in Column A are greater than the times in Column B I want a Yes in Columns C. but I keep seeing the times as 1.18055 for example.
Code:
Sub testing()
Dim cell As Range
For Each cell In Range(Cells(1, 1), Cells(3, 1))
If cell.Value <> "" Then
If Mid(cell.Offset(0, 0).Value, 2, 2) * 60 + Mid(cell.Offset(0, 0).Value, 5, 2) >= Format(Mid(cell.Offset(0, 1).Value, 4, 2) * 60 _
+ Mid(cell.Offset(0, 1).Value, 7, 2), "hh:mm:ss") Then
cell.Offset(0, 3).Value = "Yes"
Else
cell.Offset(0, 3).Value = "No"
End If
End If
Next cell
End Sub
<colgroup><col style="width:48pt" width="64" span="4"> </colgroup><tbody> </tbody> |
<tbody> </tbody> | No | ||
+03'00 | 00:01:00 | Yes | ||
+00'30 | 00:02:00 | No |
<tbody>
</tbody>
Thanks