+ Reply to Thread
Results 1 to 27 of 27

VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

  1. #1
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Hi

    I have been Googling for ages to try find an answer to this but to no avail

    I have an Excel sheet with over 8000 entries/rows.
    Column A contains ID numbers (there are approx 89 different ID numbers).
    I wish to group all the same IDs and copy them into a new sheet therefore leaving with me 89 sheets, each containing data for just that ID.

    Can this be done please without me having to manually filter for the ID's and then manually copying and pasting the relevent records into new sheets??

    I also have a very tight deadline to create this report hense trying to find a VBA to do the work for me!

    Many Thanks!!

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,641

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    For urgent matters, paying sites will be willing to do this quickly.

  3. #3
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Send me the excel file which contains 8000 rows.

  4. #4
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    It contains mainly confidential patient information, all i could send you would be column A.

  5. #5
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Not a problem, send it with column A only.

  6. #6
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Here you go...
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-25-2009
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    a pivot table will do this for you

    1. pivot your data,
    2. putting your ID into the report filter section of your pivot table field list
    3. from piviot table tools click on the options tab from the ribon
    4. click on the dropdown from options (underneath pivot table name)
    5. select // show report filter pages
    6. double click id numbers

    that will then create a tab for each of your id numbers will all the data in it

    hope it helps

  8. #8
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    I have done this previously but it's just time consuming clicking on over 89 ID numbers to create the seperate sheets. I have 4 Excel reports to do, so it would mean id have to repeat this process 4 times..and it has to be done monthly. Hence trying to find an easier automated way of doing it

  9. #9
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Use the attached macro.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    02-25-2009
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Quote Originally Posted by Alice21 View Post
    I have done this previously but it's just time consuming clicking on over 89 ID numbers to create the seperate sheets. I have 4 Excel reports to do, so it would mean id have to repeat this process 4 times..and it has to be done monthly. Hence trying to find an easier automated way of doing it
    sorry i think you miss understand me, the pivot will create a tab for each ID see attached for an example
    Attached Files Attached Files

  11. #11
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Hi - Thank you for your help...

    abduljaleel.mca - That macro only put one record on each sheet. I need all records related to each ID number copied into each sheet.

    James - The try me macro would not work, it came up with a debug error

  12. #12
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    U mean ID and its related data to be placed in a sheet...right?

  13. #13
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Yes, there may be many records for each ID number. I need all the rows copied into the sheets.
    Thanks

  14. #14
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    k fine, wait for some more minutes.

  15. #15
    Registered User
    Join Date
    02-25-2009
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    what the below video

    http://www.youtube.com/watch?v=5yj1a2VWpQ4

    cheers

  16. #16
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Thanks. I can't view youtube in work, but i'll have a look later at home.

  17. #17
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Use the updated macro
    Attached Files Attached Files

  18. #18
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Hi - that macro just did the same thing as the first.
    This is how I would like it to look...
    Attached Files Attached Files

  19. #19
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Try the attached.
    Initially had created all the sheets, but need to delete few sheets as the data had exceeds this forum's limit. There is a button on first sheet. When you run it, it will create all the sheets again.
    Attached Files Attached Files

  20. #20
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Oops...That's why I asked for the sample output earlier itself.
    I am working on it, will get back to you.

  21. #21
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Thank you AB33 - that worked perfectly!
    Is there a code that could be added to ensure the columns adjust correctly in the new sheets?

  22. #22
    Forum Contributor visha_1984's Avatar
    Join Date
    11-27-2012
    Location
    Pune,India
    MS-Off Ver
    Excel 2013
    Posts
    309

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    try this one

    Please Login or Register  to view this content.
    Happy to Help

    VISHA

    Click *, if the suggestion helps you!
    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>> "Mark your thread as Solved"

  23. #23
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Alice,
    You mean if added more columns, the code will reflect these according? Yes. The code clears all existing data and repopulate them again with fresh data

  24. #24
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    I would like all columns in the new sheets to auto adjust to show the cell contents, I don't want to have to manually adjust the column widths for all the sheets.
    I'd also like the headings in the master tab to copy across into each sheet.
    Am i asking too much now?

  25. #25
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Try the attached
    Attached Files Attached Files

  26. #26
    Forum Contributor Alice21's Avatar
    Join Date
    04-22-2010
    Location
    Wales, United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    173

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    That worked like a charm!! Thank you ever so much!
    I'm slowly getting my head around VBAs..just wish i knew more!

  27. #27
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA to copy certain data from sheet into another sheet - URGENT HELP PLEASE

    Alice,
    You are welcome! and thread closed

+ 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