+ Reply to Thread
Results 1 to 5 of 5

Macro to move specific rows from one worksheet to another

  1. #1
    Registered User
    Join Date
    06-25-2012
    Location
    KY
    MS-Off Ver
    Excel 2003
    Posts
    6

    Macro to move specific rows from one worksheet to another

    Hi -

    I've run into a little bit of a programming issue trying to figure out this simple problem. I have multiple worksheets, set up in the same way, in column "I" of the worksheets there are certain degree criteria (i.e. cert, masters, doctoral), based on this information I want the entire row to be moved into an additional worksheet. Therefore a "cert" student's information would be copied into the "certification" worksheet. The number of rows in not fixed so I know I'll need a loop, but I have columns from A-U.

    Any info would be SUPER appreciated!!!!!

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Macro to move specific rows from one worksheet to another

    I'm going to assume that you have all information that needs to be copied on some kind of master sheet, and the multiple worksheets that are setup in the same way that you mention are where you will be moving the details to.

    If that's an accurate description, here's what I'd suggest:

    Setup a variable to hold the position of the last row in the I column of your master sheet which contains data. Assuming your master sheet is named master, that line of code will look like this:
    Please Login or Register  to view this content.
    Then set up a for next loop to loop through each cell in the I column and move the data based on the value of the cell. I'm assuming that your data in the I column is "clean" meaning you won't need to check for cert, certification, certificate etc. The for next loop will look like this:
    Please Login or Register  to view this content.
    Note: I'm making guesses about the structure of your workbook sight unseen, and this code is untested. You will need to adjust it according to the names of your actual worksheets that you will be pasting on, and you will need to adjust the select case statements according to the actual values you expect to find in the I column of your "master" sheet.
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to move specific rows from one worksheet to another

    Hi LaughingLaurie
    Welcome to the Forum!
    Were it me I'd consider filtering the data by degree criteria then copying the filtered rows to the target worksheets. If you need help with this please post a sample file...I'll be happy to look at it.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    06-25-2012
    Location
    KY
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to move specific rows from one worksheet to another

    Thanks Thomas! This code worked great, one additional question - how would I go about having the data deleted from the sheet of origin while still moving it into the new sheet?

    Thanks!

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to move specific rows from one worksheet to another

    Hi LaughingLaurie

    I know you didn't ask but I'd still recommend doing this with Filters
    Please Login or Register  to view this content.

+ 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