Find Today's Date in a List-- How?
I'm totally new to this and need help desperately. I have a value in cell A1 that I have to file away. Column C contains a list of all the dates of the year. I need a macro that will check what today's date is, find that date in Column C and copy the contents of cell A1 into the cell immediately to the right of today's date (Column D). I haven't written a macro since I used Visicalc. Your help & patience is most appreciated! ~ Gary -- GaryCam ------------------------------------------------------------------------ GaryCam's Profile: http://www.excelforum.com/member.php...o&userid=32330 View this thread: http://www.excelforum.com/showthread...hreadid=520880 |
Find Today's Date in a List-- How?
This little macro will search Column C for today's date and copy A1 to the
cell to the right of today's date . Note that the code is getting today's date from the system date of your computer so make sure you have the right date set in your computer. Note that there is no error trap in this macro so you must have today's date listed in Column C. HTH Otto Sub FindDate() Dim TheRng As Range Set TheRng = Range("C1", Range("C" & Rows.Count).End(xlUp)) TheRng.Find(What:=Date, LookAt:=xlWhole).Offset(, 1).Value = Range("A1").Value End Sub "GaryCam" wrote in message ... I'm totally new to this and need help desperately. I have a value in cell A1 that I have to file away. Column C contains a list of all the dates of the year. I need a macro that will check what today's date is, find that date in Column C and copy the contents of cell A1 into the cell immediately to the right of today's date (Column D). I haven't written a macro since I used Visicalc. Your help & patience is most appreciated! ~ Gary -- GaryCam ------------------------------------------------------------------------ GaryCam's Profile: http://www.excelforum.com/member.php...o&userid=32330 View this thread: http://www.excelforum.com/showthread...hreadid=520880 |
Find Today's Date in a List-- How?
Thanks, Otto. Unfortunately when I run this one I get a Systex Error on the following line: TheRng.Find(What:=Date, LookAt:=xlWhole).Offset(, 1).Value = What am I doing wrong? Thanks again, Gary -- GaryCam ------------------------------------------------------------------------ GaryCam's Profile: http://www.excelforum.com/member.php...o&userid=32330 View this thread: http://www.excelforum.com/showthread...hreadid=520880 |
Find Today's Date in a List-- How?
Gary
You are the victim of line wrapping in these messages. The line that follows the line you cited: Range("A1").Value belongs at the end of the line you cited. HTH Otto "GaryCam" wrote in message ... Thanks, Otto. Unfortunately when I run this one I get a Systex Error on the following line: TheRng.Find(What:=Date, LookAt:=xlWhole).Offset(, 1).Value = What am I doing wrong? Thanks again, Gary -- GaryCam ------------------------------------------------------------------------ GaryCam's Profile: http://www.excelforum.com/member.php...o&userid=32330 View this thread: http://www.excelforum.com/showthread...hreadid=520880 |
Find Today's Date in a List-- How?
OK, I eliminated the word wrap problem. Now I get the following error message: Run-time Error '91': Object varaible or With block variable not set Does it matter that cell A1 contains a formula? All I need filed next to today's date is the resultant value that appears in A1? ~ Gary -- GaryCam ------------------------------------------------------------------------ GaryCam's Profile: http://www.excelforum.com/member.php...o&userid=32330 View this thread: http://www.excelforum.com/showthread...hreadid=520880 |
All times are GMT +1. The time now is 11:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com