+ Reply to Thread
Results 1 to 15 of 15

Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

  1. #1
    Registered User
    Join Date
    11-06-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    12

    Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Brand new green guy seeking help with this code. I have seen variants posted but can't seem to make any work for my situation. I will try to upload an example of my worksheet. What I am looking for is to keep a list of fleet vehicles (column A) on sheet one. this will hold real time data as work flows through the shop. As dates are entered into "Date completed" column "H", I need to have that row pasted into the next available row on sheet 2(after row1, where I will need to have my header).

    Sheet 2 will keep a running history of repairs to be referenced by access later.

    With some of the code I have seen you guys write this seems like an easy one, but it has so far illuded me! Please help.

    Thanks,
    Rekoons38
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Instead of a macro that copies and pastes, you can use formulas to accomplish this. I will build an example and post it shortly.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Put this in sheet 1: (Triggers when you put a date in column H)

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Does this help?

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Here's the file I talked about. The formulas that do compile this are all contained in sheet2. They are a combination of MATCH and INDIRECT, with some use of ADDRESS(), ROW(), and COLUMN(), that simply make use of existing positions withing the sheet so that formulas can be identical and yield different results. You can take this a step further by referring to the values in column C indirectly like this "INDIRECT("C"&ROW())", which would make the formulas all identical even beyond each row, but I didn't bother with this option. The formula rows would need to be extended (just copy a row and paste it down as far as needed) beyond the 200 I've created if the number of completed listings ever grows beyond 200.
    This is a good option if you need to have a non-macro enabled environment or you have users who don't understand how to enable macros, etc.
    I hope this helps you out.
    Attached Files Attached Files
    Last edited by bmxfreedom; 11-06-2013 at 11:47 AM.

  6. #6
    Registered User
    Join Date
    11-06-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    John, what would keep the macro from showing after save. It simply is not showing?? I have save a nd ran a few tests, so this is not making sense.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Did you place the code in the Sheet Events Module?

  8. #8
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    You need to save as a .xlsm format. (macro-enabled format).

  9. #9
    Registered User
    Join Date
    11-06-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    bmx, that is some impressive formula writting! However it is overwriting the data the next time I change information on sheet 1. I really need it to add to the next empty row on sheet 2 to keep repair history.

  10. #10
    Registered User
    Join Date
    11-06-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Saved the file as .xlsm. Alt F11 and paste into VBA editor, alt F11, alt F8 and not listed.

  11. #11
    Forum Contributor
    Join Date
    03-21-2013
    Location
    Corvallis, OR
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Quote Originally Posted by Rekoons38 View Post
    bmx, that is some impressive formula writting! However it is overwriting the data the next time I change information on sheet 1. I really need it to add to the next empty row on sheet 2 to keep repair history.
    It doesn't overwrite, it just moves. Those formulas just compile the existing list in its current order. If you need something that compiles in date order, that can be done via formulas as well, but it gets even more complicated. Compilation via change order can only be accomplished with VBA, so I suspect the VBA solution provided would be superior here.

  12. #12
    Registered User
    Join Date
    11-06-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Ok, I have copied the code, opened the vba editor and pasted the code in. It automatically changes the list boxes on top of the editor to "worksheet" instead of general on the left and on the right "Change". I should be able to go to alt f8 and view it at that time correct?
    Last edited by Rekoons38; 11-06-2013 at 01:04 PM.

  13. #13
    Registered User
    Join Date
    11-06-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today


  14. #14
    Registered User
    Join Date
    11-06-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    Don't know what I was doing wrong, but finally made John's work!! Thanks everyone for the help!!

  15. #15
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today

    You're welcome. Glad to help out, and thanks for the feedback.

+ 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. Replies: 6
    Last Post: 07-25-2013, 02:58 PM
  2. [SOLVED] macro to copy the formulas in Sheet2 to as many rows as rows available in Sheet1
    By flakedew in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-21-2012, 04:52 AM
  3. [SOLVED] Copy and Paste Entire Row from Sheet1->Sheet2 based on text string match in Sheet1 Row
    By dmlovic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2012, 08:42 AM
  4. Copy 3 cells from sheet1 then paste to sheet2
    By Christeen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-10-2011, 09:16 AM
  5. Copy cells sheet1, paste to sheet2
    By Flintstone in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2005, 04:21 PM

Tags for this Thread

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