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.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]
<colgroup><col style="width:48pt" width="64" span="4"> </colgroup><tbody>
[TD="width: 64"]+02'00
[/TD]
</tbody>[/TD]
[TD][TABLE="width: 256"]
<tbody>[TR]
[TD="class: xl63, width: 64"]00:17:00
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]No
[/TD]
[/TR]
[TR]
[TD]+03'00
[/TD]
[TD]00:01:00
[/TD]
[TD]Yes
[/TD]
[/TR]
[TR]
[TD]+00'30
[/TD]
[TD]00:02:00
[/TD]
[TD]No
[/TD]
[/TR]
</tbody>[/TABLE]
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
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]
<colgroup><col style="width:48pt" width="64" span="4"> </colgroup><tbody>
[TD="width: 64"]+02'00
[/TD]
</tbody>
[TD][TABLE="width: 256"]
<tbody>[TR]
[TD="class: xl63, width: 64"]00:17:00
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]No
[/TD]
[/TR]
[TR]
[TD]+03'00
[/TD]
[TD]00:01:00
[/TD]
[TD]Yes
[/TD]
[/TR]
[TR]
[TD]+00'30
[/TD]
[TD]00:02:00
[/TD]
[TD]No
[/TD]
[/TR]
</tbody>[/TABLE]
Thanks