+ Reply to Thread
Results 1 to 9 of 9

Copy a row record to a sheet based on the date entered in to a cell

  1. #1
    Registered User
    Join Date
    09-14-2011
    Location
    Guernsey
    MS-Off Ver
    Excel 2007
    Posts
    5

    Copy a row record to a sheet based on the date entered in to a cell

    Hi All,
    I have scoured lots of forums and still cannot get the code for this to work.
    I have a workbook with 13 sheets, sheet 1 is "Main Data" the other twelve are the months of the year Jan to Dec
    On the Main Data sheet contains thousands of rows/records there are 3 columns where the users can enter dates, column C "Inception" column D "First response" and column E "Future Meeting".

    What I need is that if any user enters a date in to any of the 3 columns then that row/record is copied and the values pasted to the next empty row on the relative month sheet, the copy and paste should happen once the user presses the enter button on the keyboard after entering a date.

    Looking forward to any answers

    Gary
    Last edited by Gary Stunell; 05-27-2016 at 04:53 AM. Reason: add some more words

  2. #2
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Copy a row record to a sheet based on the date entered in to a cell

    Hello,

    To be clear, you are saying that a user entering a date into any of three cells on the main page and pressing [enter] will result in that date being pasted as a value into the sheet representing that month?

    There is no extra data to input or paste over? Are the month sheets named, or numbered?
    IF("helping me", "thanks", "need more detail?")

  3. #3
    Registered User
    Join Date
    09-14-2011
    Location
    Guernsey
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy a row record to a sheet based on the date entered in to a cell

    Hi Jay,
    When a user enters the date in one of the 3 columns in the Main Data sheet then that entire row/record needs to be copied and the values pasted in to the month sheet.

    The month sheets are named "January" "February" etc through to "December"

    Gary

  4. #4
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Copy a row record to a sheet based on the date entered in to a cell

    Hello, sorry this reply took so long... i'm still learning about excel code myself so it took me a while to work out all the bugs.

    I believe this will work for you but i stress that you really should save and backup your work, and use a test sheet beforehand because you may ned to alter the code slightly!

    you should paste this into the "microsoft excel objects" area for the main sheet:

    Please Login or Register  to view this content.
    Last edited by jayherring86; 05-27-2016 at 10:18 AM.

  5. #5
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Copy a row record to a sheet based on the date entered in to a cell

    As a note, the part of the code that says "Sheets(strMonth).Cells(23000, 1).End(xlUp).Row).Address" is telling excel to start at A23000 and press "end" then "up" to find the last row of your data. If your column A is not used, change the 1 in Cells() to a column which is always filled in. If your data list extends beyond row 23000, change the 23000 to something much larger.

    Also, the rngToCopy is pointed to sheet1 in your workbook - you should change it to say "Sheets("Main Data")" or whatever your main data sheet is called

    I hope this works, i am available to troubleshoot it if not

  6. #6
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Copy a row record to a sheet based on the date entered in to a cell

    Oh, and since you didn't specify that you didn't want the information on the main data page to dissapear once it was copied and pasted, there isn't really a user feedback that it has happened.

    If you'd like, you can either clear the cells by writing the following just before the bit in the code that says "else: exit sub":

    Please Login or Register  to view this content.
    or, you can give a user feedback (cleared by pressing the enter key), by pasting to the same place:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-14-2011
    Location
    Guernsey
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy a row record to a sheet based on the date entered in to a cell

    Hi Jay,
    Sorry for the delay, bank holiday here, works perfectly, many thanks

  8. #8
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139
    Im thrilled that it worked!
    May i ask whether you opted for a user feedback?

    Either way, im glad to help.

  9. #9
    Registered User
    Join Date
    09-14-2011
    Location
    Guernsey
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Copy a row record to a sheet based on the date entered in to a cell

    Hi Jay,

    I moved the file to another machine that only uses 2007 and each time I try it this line of code comes up as stopping it from running.

    Any ideas?

    Gary


    Set rngToPaste = Sheets(strMonth).Range(Rows(Sheets(strMonth).Cells(23000, 1).End(xlUp).Row).Address)
    Last edited by Gary Stunell; 06-02-2016 at 05:26 AM. Reason: spelling mistake

+ 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. [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
  2. [SOLVED] Copy Paste a Range of Values from a Different Sheet Based on Value Entered in Cell
    By hamidxa in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-13-2015, 04:53 PM
  3. Replies: 0
    Last Post: 11-25-2014, 05:30 PM
  4. [SOLVED] Insert Row and Record in Another Sheet Once I entered date
    By atulexel79 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-22-2014, 10:04 AM
  5. VBA for copy record to sellected 2 sheet & clear entry sheet for new record
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-24-2012, 10:54 PM
  6. Cell formula to record many values and date entered
    By Stryda in forum Excel General
    Replies: 11
    Last Post: 11-13-2011, 04:28 PM
  7. [SOLVED] recording the date when record was entered in cell in Excel
    By mcgoo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-10-2005, 07:06 PM

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