+ Reply to Thread
Results 1 to 8 of 8

copying selected data from sheet to new sheet

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2007
    Posts
    9

    copying selected data from sheet to new sheet

    I am looking for a macro to select a set of data and paste to a new sheet , I have around 6000 lines of data defined by an ID number which has been produced by another software package, but I need to copy each individual (ID number) to a new sheet. Each ID has varies in the number of lines of data.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: copying selected data from sheet to new sheet

    Hi Neil. For clarification ... do you want to have all the rows with the same ID number on a separate sheet? Perhaps you could post a copy of your file to make it easier to understand.

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: copying selected data from sheet to new sheet

    Yes, exactly.

    I have plodded through by copying and pasting the code selecting 22,23,24 rows depending on how many rows corresponding to each ID, but not sure if there is an easier/faster way to code the macro to select rows with the same ID?

    File attached
    Attached Files Attached Files

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: copying selected data from sheet to new sheet

    Where is the source sheet that contains all the data?

  5. #5
    Registered User
    Join Date
    01-25-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: copying selected data from sheet to new sheet

    Its the bcarcmh tab

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: copying selected data from sheet to new sheet

    Hi Neil. Please make a backup of your file and then, working with the backup, make a few changes. Copy the code below into a regular module. Then delete all the sheets except for your data source sheet. After running the macro, sheets will be automatically created and named according to the ID number and then the data for each ID will be copied over. Please be patient after you click the button. Since you have up to 6000 rows, it can take a little time to complete the task. Let me know if this suits your purpose.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-25-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: copying selected data from sheet to new sheet

    Thanks for all you help, works beautifully.

    Is there a textbook that you could recommend for programming in visual basic to help me work through some of these problems myself?

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: copying selected data from sheet to new sheet

    Hi Neil. I'm glad that everything worked out for you. I would imagine that there are many, many books available but I'm not familiar enough with any of them to make a recommendation. I find that by doing searches on the web, I can usually get the information I want. There are also on-line videos and tutorials that may be useful. Forums, however, have been my main source of help. I find that the more code writing I do, the more I learn and since I'm retired, I have the time to make it a hobby. Good luck!

+ 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