+ Reply to Thread
Results 1 to 6 of 6

VBA to filter data, copy and paste into new worksheet

  1. #1
    Registered User
    Join Date
    04-18-2016
    Location
    Saskatchewan
    MS-Off Ver
    2011
    Posts
    10

    VBA to filter data, copy and paste into new worksheet

    Good Morning all,

    Can anyone help me with some code that can autofilter, copy, and paste to a new sheet that is named after the filtered field?

    Row 1 has column headers and column B contains the unique values that I want to filter by. There will be multiple rows containing each unique value (About 41 unique values).

    Is there a way to write the code to make the macro filter each unique value without knowing what those values are?

    I also need it to create a new sheet and name the sheet after the unique value from column B.

    Next, it would need to copy the filtered data and paste it to the newly created sheet.

    It would need to repeat this process until each unique data set (41) has been copied to their respective sheet.

    I have used the record macro to filter the first unique item to give people a look at what I am trying to do.


    Please Login or Register  to view this content.
    I have google searched and found some coding that is similar and tries to achieve the same but due to my lack of experience VBA, I wasn't able to make this one work


    Please Login or Register  to view this content.
    Please help!

    Thanks
    Last edited by JBeaucaire; 06-14-2016 at 10:55 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: VBA to filter data, copy and paste into new worksheet

    Hello Ngan202,

    Perhaps the following code may do:-

    Please Login or Register  to view this content.
    It creates new sheets based on Column B values and then transfers each row of data associated with that value to the respective individual sheet.
    Headings are transferred also.

    I've attached my test work book for you to play with. Click on the button to see it work.

    I hope that this helps.

    Cheerio,
    vcoolio.

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

    Re: VBA to filter data, copy and paste into new worksheet

    'SHEET1 TO MANY SHEETS
    Here's a published macro for parsing rows of data from one sheet to many sheets named for the same values in a specific column.It not only can parse the rows, it can create the sheets if they are missing. There is a sample sheet there where you can test this out.
    Last edited by JBeaucaire; 12-26-2019 at 03:57 PM.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    04-18-2016
    Location
    Saskatchewan
    MS-Off Ver
    2011
    Posts
    10

    Re: VBA to filter data, copy and paste into new worksheet

    Quote Originally Posted by vcoolio View Post
    Hello Ngan202,

    Perhaps the following code may do:-

    Please Login or Register  to view this content.
    It creates new sheets based on Column B values and then transfers each row of data associated with that value to the respective individual sheet.
    Headings are transferred also.

    I've attached my test work book for you to play with. Click on the button to see it work.

    I hope that this helps.

    Cheerio,
    vcoolio.
    This is exactly what i needed. I have had a chance to play around with it and works well for my purpose. The msgbox and button are all nice touches. Thank you vcoolio.

  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: VBA to filter data, copy and paste into new worksheet

    As it appears you've reached a conclusion, I've marked this thread SOLVED for you.
    FYI, this is done through the Thread Tools located above the first post in this thread. Thanks.

  6. #6
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: VBA to filter data, copy and paste into new worksheet

    Hello Ngan202,

    You're welcome. Glad that I was able to help.

    Cheerio,
    vcoolio.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Filter, Copy, Paste onto New Worksheet
    By gssc141 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2015, 10:35 AM
  2. [SOLVED] Way to filter out Unused space and Copy/paste onto another worksheet
    By bdouglas1011 in forum Excel General
    Replies: 6
    Last Post: 09-29-2014, 11:41 AM
  3. [SOLVED] VBA to Filter out Blank Cells, copy /paste into another worksheet
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2014, 03:36 AM
  4. type mismatch while trying to filter and copy rows and paste to another worksheet
    By perducci in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2012, 02:59 PM
  5. vba Copy Filter item and paste at other worksheet
    By gingank in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2012, 06:21 AM
  6. how to filter and copy data from one sheet and paste to new worksheet
    By mr_asrul in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-03-2008, 07:15 AM
  7. Replies: 5
    Last Post: 03-18-2006, 08:45 AM

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