+ Reply to Thread
Results 1 to 13 of 13

Macro in excel to move a row of data from one worksheet to another worksheet

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    8

    Post Macro in excel to move a row of data from one worksheet to another worksheet

    This is the first time I have tried creating a macro. I have an excel workbook that has 6 worksheets (Completed, Brian, Ed, Jason, Bill, and Steve). The header rows in all the worksheets are titled the same. So, when column "M" - "Task Closed" has a date entered in it, I need that row cut and pasted to the next open row in the "Completed" worksheet. Then the row that was cut (blank row) shifted up. I need this done for all the worksheets (Brian, ed, Jason, Bill, and Steve). Is this possible?

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    This is possible. However, do you want it to happen instantly? Or do you want to enter the values in all the sheets and then click on a button to run the macro?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    02-19-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    I would love for it to do it instantly, if possible

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    Try this code -
    Please Login or Register  to view this content.
    Press Alt+F11 on your file. Then on the left hand side you will see an option called "ThisWorkbook". Double click on it and enter the code in the code window on the right. Then make changes to your file ensuring that you update column M and watch the rows move to the Completed sheet.

  5. #5
    Registered User
    Join Date
    02-19-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    I don't know what I did wrong, but it didn't work. I attached the file.
    Attached Files Attached Files

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    Put
    Please Login or Register  to view this content.
    before this line
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-19-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    When I entered a date in column "m" in the "Brian" worksheet, It copied it but did not delete the row. When I entered a date in the "Ed" worksheet it didn't move, copy or delete it. And it keeps hanging up and I end up going to the task manager to end the program, so that it will close and I can re-open it.

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    I faced that issue on my system when i ran it on a dummy file. So i thought it was an issue on my system. But when i ran it on your attached file, it worked fine.

    Can you try saving, closing and opening the file?

  9. #9
    Registered User
    Join Date
    02-19-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    I tried replying yesterday and apparently the system went down. I resaved it started from scratch on a dummy file and the "completed", and "brian" worksheets worked, but the others did not. when i went to enter the date on them, it hung up and had to go into the task manager.

  10. #10
    Registered User
    Join Date
    02-19-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    Thank you ! Thank you! Thank you! It worked. I had a column in the completed worksheet that did not match. When i fixed it the code worked. You are fantastic. Thank you for patience.

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    Am glad it worked.

  12. #12
    Registered User
    Join Date
    02-26-2013
    Location
    Oklahoma, United States
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    I have a question. I have the exact situation, but instead of column M, it is column I. When I take the above macro, and change the M to an I, I get a debug error for the line, Target.EntireRow.Delete. Then if I add the On Error resume next, it will move the item and then the item just be low it several times to the completed tab. Do you know what I might be doing wrong? Thanks!!

  13. #13
    Registered User
    Join Date
    02-19-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro in excel to move a row of data from one worksheet to another worksheet

    I have no idea. But what I did figure out with mine is that the titles rows had to be exactly the same. When they weren't it kept taking the row and everything below it to the completed sheet. I am sure Arlu1201 can help you out with is. Good Luck.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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