+ Reply to Thread
Results 1 to 5 of 5

Macro to copy entire group of rows to another worksheet and another workbook

  1. #1
    Registered User
    Join Date
    08-26-2010
    Location
    Poplar Bluff MO
    MS-Off Ver
    Excel 2016
    Posts
    98

    Macro to copy entire group of rows to another worksheet and another workbook

    I have a spreadsheet with about 800 rows. In column D, there is a variety of numbers from 013 to 080. There could be anywhere from 2 to 100 rows to each number. Everytime the number changes in column D, I would like to copy that group of rows to either another tab or to another worksheet. So, Rows 1-5 have 013 and rows 6-20 have 018 in column D and rows 21-81, have 025 in column D. Is is possible to have it moves rows 6-20 to one worksheet and rows 21-81 to another worksheet and keep going until there is no more data?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to copy entire group of rows to another worksheet and another workbook

    Hello exc1967,

    This macro will copy row data starting with cell "D1" to either a new worksheet or existing worksheet with the name of the cell's contents. The values in column "D" do not need to be sorted first.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-26-2010
    Location
    Poplar Bluff MO
    MS-Off Ver
    Excel 2016
    Posts
    98

    Re: Macro to copy entire group of rows to another worksheet and another workbook

    It looks like this is doing exactly what I wanted, except it ommits some of the data and it appears when the same name is on there multiple times, it carries with it the data from only one of the lines. I looked at the code thinking I could figure out what was wrong but I couldn't. I have copied the macro into this workbook also along with some sample data, with names and numbers changed.

    I really appreciate your help.

    thanks so much!!!!!
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to copy entire group of rows to another worksheet and another workbook

    Hello exc1967,

    I fixed the problem and added some features. The screen flicker is gone,and the header row is now copied to each worksheet when it is created and a button has been added to "Sheet1" to run the macro. Here is the updated macro that has been added to the attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-26-2010
    Location
    Poplar Bluff MO
    MS-Off Ver
    Excel 2016
    Posts
    98

    Re: Macro to copy entire group of rows to another worksheet and another workbook

    Absolutely Perfect. Thanks so much.

+ 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