MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Find Dates

Posted by Roy on August 20, 2001 10:11 AM

Still struggling with this. I have included a snap of the sheet I am using.

I need to be able to input 2 dates and then the information that falls within these 2 dates will be copied onto sheet 3 as it is on sheet 2. If anyone can give me the code to do this it would be greatly appreciated


Posted by Robb on August 20, 2001 2:35 PM


I answered this one before - did it not work? Reply was:

You'll have to adjust to your ranges, but this should do what you want:

Sub RCopy()
Dim D1 As Date, D2 As Date, R2 As Integer, copR As String
D1 = InputBox("Enter a date")
D2 = InputBox("Enter a second date")
R2 = 2
copR = "A" & CStr(R2)
For Each r In Worksheets("sheet1").UsedRange.Rows
n = r.Row
If Cells(n, 1) = D1 Or Cells(n, 1) = D2 Then
r.Copy Destination:=Worksheets("Sheet2").Range(copR)
R2 = R2 + 1
copR = "A" & CStr(R2)
End If
Next r

End Sub

Does this help?