Thread: Date Diff Help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RyanH RyanH is offline
external usenet poster
 
Posts: 586
Default Date Diff Help

This should work for you. This macro will run down rows 2 thru last row in
Col.A

Option Explicit

Sub TestDates()

Dim i As Long

For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row
If (Cells(i, "A").Value And Cells(i, "B").Value) < _
(Cells(i, "C").Value And Cells(i, "D").Value) Then
Cells(i, "E").Value = "Yes"
Else
Cells(i, "E").Value = "No"
End If
Next i

End Sub

Hope this helps! If so, please click "YES" below.
--
Cheers,
Ryan


"kiran" wrote:

Dear All,

A B C D E
Date Time Date Time Output
04.07.08 9:18:56 AM 01.08.08 7:41:33 PM
04.08.08 9:18:56 PM 01.08.08 7:41:33 PM
24.08.08 10:05:03 AM 22.08.08 12:13:30 PM

Check date time in column A, B, C & D if date & time of column C & D is
greater that date time of column A & B I should get "No" else "Yes" in column
E.

TIA