+ Reply to Thread
Results 1 to 10 of 10

Move Row to New Worksheet

  1. #1
    Registered User
    Join Date
    05-30-2009
    Location
    Huntsville, Alabama
    MS-Off Ver
    Excel 2003
    Posts
    5

    Move Row to New Worksheet

    I have a worksheet to track projects. I want to move a row to a new worksheet when the project is complete. The completed project is based on wether a column cell has any data.I have attached the spreadsheet. Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Move Row to New Worksheet

    Hi Papa, welcome to the forum.

    This macro will move all the rows on sheet Project List to the Complete sheet if there is a date in the Actual Completion column. Every time you run it, it will append the rows moved to the bottom of the projects already on the Complete sheet.
    Please Login or Register  to view this content.
    How to use the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet
    Attached Files Attached Files
    Last edited by JBeaucaire; 05-30-2009 at 11:05 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    05-30-2009
    Location
    Huntsville, Alabama
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Move Row to New Worksheet

    Thanks JBeaucaire. I have the VBA opened however it appears all of the editing features are transparent. What am I doing wrong? Is the spreadsheet locked out?

  4. #4
    Registered User
    Join Date
    05-30-2009
    Location
    Huntsville, Alabama
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Move Row to New Worksheet

    I moved everything to a new ws. It wprks if I go in to VBA and manually run the app. How do I make the macro run automatically?

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Move Row to New Worksheet

    It's not an automatic macro. You need to include in your list or requirements the thing you feel should "trigger" the macro if you want it to happen on its own.

    I know, you're going to say "When I mark a row complete, it should move"...right? Well, use caution here. You don't think you could accidentally mark the wrong row? Stuff like this where you permanently move completed stuff to another sheet, i REALLY want to suggest you add a button to the top of your sheet so you can just click it to move the rows.
    • Turn on the FORMS Toolbar.
    • Click on Button icon and draw a button at the top of the sheet.
    • The ASSIGN MACRO window will appear automatically
    • Select the Completions macro you've already put in your sheet.
    • Now edit the label on the button to "Archive Completions"
    • Click on a blank part of your sheet to deselect the button

    It's not ready to use and will run the macro any time you click it.

    Will this be sufficient? That's how I would implement something like this.

  6. #6
    Registered User
    Join Date
    05-30-2009
    Location
    Huntsville, Alabama
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Move Row to New Worksheet

    Thanks for the response. For grins anf giggles I ran the macro without data in the field and got error 1004. I have a wee bit VB under my belt so I used the on error to jump around the code and end the sub. I figured out how to use keystrokes to start the macro. I'm using ctrl x to initiate the "macro" however the use of a button is cleaner. What I am working on now is trying to figure out how to automatically restore the auto filters automatically. Any thoughts?

  7. #7
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: Move Row to New Worksheet

    If you're looking to learn more about VBA the best way to do it is just jump in and start flailing around trying to figure out new things. In this case -
    restore the auto filters automatically
    I'd start with the macro recorder.

    Record a macro of you manually doing whatever it is you want to do, then tweak that code, and paste it onto the end of the macro you already have.
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Move Row to New Worksheet

    My apologies, I thought the autofilters were in the original data on accident, so I included a line of code to remove them. In the macro I posted, take out this line:
    Please Login or Register  to view this content.
    ...it's the last line before the end. Remove that.


    EDIT:
    Or better, yet, change it to this to just show all lines again:

    Please Login or Register  to view this content.
    That's better.
    Last edited by JBeaucaire; 05-31-2009 at 05:50 PM.

  9. #9
    Registered User
    Join Date
    05-30-2009
    Location
    Huntsville, Alabama
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Move Row to New Worksheet

    We have a solution. Thank you for your help.

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Move Row to New Worksheet

    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].



    (Also, use the "scales" icon in our posts to leave Feedback, it is appreciated)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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