+ Reply to Thread
Results 1 to 8 of 8

Move rows of data back and forth from one worksheet to another automatically

  1. #1
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Move rows of data back and forth from one worksheet to another automatically

    Hello, I would like to move rows of data back and forth from one worksheet to another automatically based on a date value.

    One worksheet will contain "Active Development Projects" and the other worksheet will contain "Completed Development Projects." Projects are listed by row. Both worksheets have the same column headings to line up all of the data.

    Once a project completion date is entered into the column titled "DE Complete Date" (column R) this should trigger that entire row to be moved to the worksheet "Completed Development Projects." Each new row that moves to the "Completed" worksheet will be added below the last row that is populated (hope this makes sense).

    If the project was inadvertently moved to the "Completed Development Projects" worksheet, I would like to automatically move it back to the "Active Development Projects" worksheet using a trigger as well - maybe by removing the date from the "DE Complete Date" (column R) cell. Again, the place of this row of data back to the "Active Development Projects" could be after the last populated row in the worksheet.

    I tried using the VBA code below and it worked at first, but then stopped working and it only addressed moving the row of data from Active to Completed and not back. You can see this code in the attached sample spreadsheet.

    Any help to make this all happen would be greatly appreciated! Thank you in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Move rows of data back and forth from one worksheet to another automatically

    You will need worksheet_change event code in both worksheets.
    I moved away from named ranges and set variables, no need for that..
    also stay away from cutting entirerows just cut and paste the used columns in this case 19 cols
    no need to use select and selection for simple cut and paste. so

    You will see both codes are very simular just the if test and destination after cut is different

    for the active development projects you need
    Please Login or Register  to view this content.
    for the Completed tab you need
    Please Login or Register  to view this content.
    the .Cells(Rows.Count, 1).End(xlUp).Offset(1) in the paste destination will make sure the moved project is always pasted at the bottom of eighter list.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Move rows of data back and forth from one worksheet to another automatically

    Thank you so very much for this - it just about works and is amazing. However, I am not sure why, but when I add a date to one of the rows, an additional row disappears. I did limited testing on this, but took time to create the attached Word document with screen images and notes to show what is happening.
    Any thoughts based on this?

  4. #4
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Move rows of data back and forth from one worksheet to another automatically

    I am posting another reply to hopefully get some more assistance to resolve the problem with the first worksheet when it auto moves the row of data based on inputting a completion date, it takes that row (which it should) AND the very top row (whatever is in row 2) and deletes that row completely (which it should not.

    It also leaves an empty space for the row that it did move, which is not that much of a problem and I can live with that if need be.

    Can anyone help with this?

    I am attaching another copy of the spreadsheet for ease of reviewing.

    Thank you

  5. #5
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Move rows of data back and forth from one worksheet to another automatically

    It took me a bit to figure out what was wrong, still dont get why. But I found a way to get it to work

    this is the code for the active orders sheet

    Please Login or Register  to view this content.
    the code for the completed sheet is in the attachment.. have a look if this works
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Move rows of data back and forth from one worksheet to another automatically

    I didn't realize you were working on this - thank you so much! This seems to work. I am going to do some more testing before I mark this as solved, but this looks great right now! Thank you again.

  7. #7
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Move rows of data back and forth from one worksheet to another automatically

    Dont worry, I did not let you know I was..
    and I was not even sure I was still working on it.. Yesterday I could not figure it out, only after your post I looked at it again and then the penny dropped on how to solve..
    Last edited by Roel Jongman; 12-11-2019 at 12:08 PM.

  8. #8
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Move rows of data back and forth from one worksheet to another automatically

    Looks like this works - This is amazing - Thank you so much for your great help!

+ 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] Automatically move data from one worksheet to another when a certain criteria is met
    By Rogerjw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2015, 08:27 AM
  2. Replies: 8
    Last Post: 02-16-2015, 03:39 AM
  3. [SOLVED] Macro to Move Rows to New Worksheets Based on Criteria & Then HIDE & Move Back
    By abro0821 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-22-2014, 04:00 PM
  4. Automatically move row of data in table from one worksheet to another
    By steveb1988 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2014, 05:07 PM
  5. Replies: 2
    Last Post: 08-27-2013, 05:01 PM
  6. Automatically move rows to another worksheet based on cell value
    By Jon Edwards in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-11-2013, 12:51 PM
  7. [SOLVED] Move data to another worksheet and automatically run macro.
    By ghoshl1 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-12-2012, 02:16 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