Finding multiple occurances of a date within one column: Should be easy?

M

Mcasteel

I'm having a hard time returning multiple dates from
worksheet("Customer Enrollment") column(68) to a seperate worksheet("T
Do List").

The User inputs the date he/she is looking for into an input bo
(strReportDate), later converted to "dtReportDate".

I WANT TO RETURN ALL OCCURANCES OF THE MATCHING DATE FROM COLUMN 68.
WHEN EACH MATCHING DATE IS RETURNED ID ALSO WANT TO INCLUDE TH
CORROSPONDING NAME FROM COLUMN 67 TO THE NEW WORKSHEET (TO DO LIST)

I can handle returning the name's, but Im not sure how to retur
multiple matching dates from column 68.



*Column 68 * (Dates from worksheet("Customer Enrollment")
-----------------------------------------------------------------------------------
10/23/2004 (these are date values in the spreadsheet)
10/25/2004
11/01/2004
11/01/2004
11/01/2004
11/02/2004
11/04/2004
11/04/2004
11/05/2004
11/05/2004
11/07/2004

Column 67 (Also from Sheet "Customer Enrollment") (2nd Priority)
----------------------------------------------------------------------------------
Name1
Name2
Name2
Name3
Name4
Name1
Name3
Name6
Name4
Name4
Name5



Can anyone help to guide me through this, Ive been beating myself u
over this one for a couple of days.

Thank you.

Mike

===============================================
_Sample_of_what_I_would_like_to_return:_

if seaching for date: 11/01/2004 Return:

11/01/2004 Name2
11/01/2004 Name3
11/01/2001 Name4

if seaching for Date: 11/05/2004 return:

11/05/2004 Name4
11/05/2004 Name
 
T

Tom Ogilvy

Sub CopyDates()
Dim rng As Range, cell As Range
Dim dtReportDate As Date
Dim strReportDate
strReportDate = InputBox("Enter date")
If IsDate(strReportDate) Then
dtReportDate = CDate(strReportDate)
Else
Exit Sub
End If
With Worksheets("Customer Enrollment")
Set rng = .Range(.Cells(1, 68), .Cells(Rows.Count, 68).End(xlUp))
End With
For Each cell In rng
If cell.Value2 = CLng(dtReportDate) Then
cell.Offset(0, -1).Resize(1, 2).Copy _
Destination:=Worksheets("To Do List") _
.Cells(Rows.Count, 1).End(xlUp)(2)
End If
Next
End Sub

Untested pseudocode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top