+ Reply to Thread
Results 1 to 2 of 2

Copy rows into different Sheet based on todays date

  1. #1
    Registered User
    Join Date
    02-14-2018
    Location
    Denmark
    MS-Off Ver
    365
    Posts
    4

    Copy rows into different Sheet based on todays date

    Dear all,

    I have a spreadsheet with different pharmaceuticals and need to make sure the expiration date is not missed. Therefore i would like to have a button to press every time i upload new data to the sheet. I would like the whole row copied if the date is under todays date - Let's say the date in H2 is under todays date, then i would like for A2-L2 copied into the next sheet. Notice that some of the cells are empty. The attached excel file is a small part of the larger excelsheet with around 11.000 rows

    From looking at kinda similar questions I ended up with this VBA code, which does not work.

    Sub CopyRows()

    'MakroCopyRows

    Application.ScreenUpdating = False

    With Sheet1.[H1].CurrentRegion
    .AutoFilter 7, "<" & [Today()]
    .Offset(1).Copy Sheet3.Range("A" & Rows.Count).End(3)(2)
    .AutoFilter
    End With

    Application.CutCopyMode = False
    Application.ScreenUpdating = True

    End Sub

    I hope you guys can help out.

    Regards,

    Esebn
    Attached Files Attached Files

  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 rows into different Sheet based on todays date

    This runs:

    Please Login or Register  to view this content.
    Let me know if it's what you want.

    BTW:Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Last edited by xladept; 12-10-2018 at 02:16 PM.
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy cells to worksheet based on todays date
    By heffers1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-05-2018, 05:35 PM
  2. [SOLVED] Copy,Cut, Paste Row to different sheet when date entered becomes todays date - Please Help
    By Mykull in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-11-2016, 01:55 PM
  3. Macro to copy rows based on moving date and paste the rows into an identical sheet
    By ivandc1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2014, 11:59 AM
  4. Copy/paste row with todays date in Sheet2 to sheet 3....but from Sheet 1
    By cammyjane10 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-25-2013, 01:07 PM
  5. [SOLVED] Sheet Protection based on todays date....
    By aleenkhan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2012, 04:49 PM
  6. Using VB to find a range based on todays date and todays date +30
    By Steve_al in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 09:31 AM
  7. Use button on sheet to transfer data based on todays date
    By Qaspec in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2005, 01:37 AM

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