+ Reply to Thread
Results 1 to 6 of 6

copy and paste if dates match

  1. #1
    Registered User
    Join Date
    04-20-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    17

    copy and paste if dates match

    Hi Excel Masters,

    I am in need of help in creating a Macro to automate parts of my tedious daily tasks.

    I will explain what I need to do using the attached Excel test file I created. There are dates that represent working days. I would like to compare equivalency of “Today’s date” from cell A2 to each of the dates starting in cell A10. If the two dates match, then I want cell B11 to be copied and pasted into cell B12, C11 to C12, F11 to F12 and G11 to G12. Also, if the dates match, I would like to copy and paste Daily update data from D2 to D12, D3 to E12, I2 to U12 and I3 to I12.

    Today’s date will update automatically when the Excel file is opened. Same with the Daily Update numbers. There are formulas in the cells containing “formula 1” and “formula 2”.

    Of course this is a much scaled down version of my original file and I can’t use formulas because numbers change daily and there is no history to recall from by using a vlookup.

    Any help would be appreciated. I hope I'm being clear in what I'm looking to do.

    Thanks in advance.

    -Donkey
    Test for data.xlsx

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: copy and paste if dates match

    Hi donkey1,

    Here's this - (except for I2 to U12):

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    04-20-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: copy and paste if dates match

    hi xladept,

    i'm having some issues getting the code to work properly on my real data after i adapt the code in the same format. unfortunately i can't show you the real data because of secrecy and they are linked into other files.

    however, for the following two activities, can you add something so that they do a paste special formula

    Range("B" & r - 1).Copy Range("B" & r): Range("C" & r - 1).Copy Range("C" & r)
    Range("F" & r - 1).Copy Range("F" & r): Range("G" & r - 1).Copy Range("G" & r)

    also for the following two activities, can you add something so that they do a paste value

    Range("D2").Copy Range("D" & r): Range("D3").Copy Range("E" & r)
    Range("I2").Copy Range("H" & r): Range("I3").Copy Range("I" & r)



    thank you

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: copy and paste if dates match

    Hi donkey1,

    Try this:

    Please Login or Register  to view this content.
    'I made them all PasteValues but you can change that

    Please Login or Register  to view this content.
    Last edited by xladept; 08-28-2012 at 04:27 PM.

  5. #5
    Registered User
    Join Date
    04-20-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: copy and paste if dates match

    xladept,


    thanks a million. i finally got around to adapting it to my file and it works wonderfully
    Last edited by donkey1; 09-20-2012 at 10:52 AM. Reason: Solved

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: copy and paste if dates match

    You're welcome!

+ 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