![]() |
Finding multiple occurances of a date within one column: Should be easy?
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 -- Mcastee ----------------------------------------------------------------------- Mcasteel's Profile: http://www.excelforum.com/member.php...fo&userid=1569 View this thread: http://www.excelforum.com/showthread.php?threadid=27743 |
Finding multiple occurances of a date within one column: Should be easy?
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. -- Regards, Tom Ogilvy "Mcasteel" wrote in message ... I'm having a hard time returning multiple dates from a worksheet("Customer Enrollment") column(68) to a seperate worksheet("To Do List"). The User inputs the date he/she is looking for into an input box (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 THE 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 return 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 up 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 Name4 -- Mcasteel ------------------------------------------------------------------------ Mcasteel's Profile: http://www.excelforum.com/member.php...o&userid=15698 View this thread: http://www.excelforum.com/showthread...hreadid=277431 |
All times are GMT +1. The time now is 07:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com