The "Int" did the trick Rick! Here is my code for retaining only the data
between a start and end date.
With Worksheets("WorksheetName")
lastrow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
If Int(Range("A" & i)) < StartDate Then
.Rows(i).Delete
i = i - 1
Else
Exit For
End If
Next i
lastrow = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To 30
For j = 2 To lastrow
If Int(Range("A" & j)) = EndDate Then
.Rows(j + 3).Delete
End If
Next j
Next i
End With
"Rick Rothstein (MVP -
VB)" wrote:
If you want a match, you will need to get rid of the time portion.
Something like
If Format(StartDate, "m/d/yyyy") = Format(Now, "m/d/yyyy") Then
'do something
End If
If StartDate is declared as a Date variable, then you should be able to do
the above test like this...
Dim StartDate As Date
StartDate = #September 6, 2007 9:19PM#
If Int(StartDate) = Date Then
'do something
End If
Rick