+ Reply to Thread
Results 1 to 6 of 6

Find Today's Date in a List-- How?

  1. #1
    Registered User
    Join Date
    03-09-2006
    Posts
    3

    Question 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

  2. #2
    Otto Moehrbach
    Guest

    Re: 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" <GaryCam.24fkta_1141955401.7625@excelforum-nospam.com> wrote in
    message news:GaryCam.24fkta_1141955401.7625@excelforum-nospam.com...
    >
    > 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
    >




  3. #3
    Registered User
    Join Date
    03-09-2006
    Posts
    3

    Unhappy

    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

  4. #4
    Otto Moehrbach
    Guest

    Re: 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" <GaryCam.24gm2y_1142003701.0183@excelforum-nospam.com> wrote in
    message news:GaryCam.24gm2y_1142003701.0183@excelforum-nospam.com...
    >
    > 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
    >




  5. #5
    Registered User
    Join Date
    03-09-2006
    Posts
    3

    Unhappy

    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

  6. #6
    Otto Moehrbach
    Guest

    Re: Find Today's Date in a List-- How?

    Gary
    That macro works for me just fine. Tell me what version of excel you
    are running. Also send me, direct via email, the file in which you are
    using this macro. My email address is ottokmnop@comcast.net. Remove the
    "nop" from this address. Otto
    "GaryCam" <GaryCam.24hb2y_1142036101.6572@excelforum-nospam.com> wrote in
    message news:GaryCam.24hb2y_1142036101.6572@excelforum-nospam.com...
    >
    > 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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1