+ Reply to Thread
Results 1 to 8 of 8

Splitting Data Into Separate Files Based on Pre-Populated List

  1. #1
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Splitting Data Into Separate Files Based on Pre-Populated List

    Hello, Every week our company gets a planning schedule that has a list of part numbers in column A and other information such as quantity and ship date in the other corresponding columns.

    These parts are handled by different people in the company so what I want to do is split up the large file into smaller files that only have each persons parts.

    I have read other forum posts that show macros on how to do this but it is actually scanning the file for a persons name and then creating a file based on the name, in my file there is no names only part numbers.

    I believe it would work something like this; we would first need to populate a list with all possible part numbers and their corresponding employee. Then each week when the planning sheet comes in it would scan that list and dump the corresponding parts into a file based on the persons name. I just don't know anything about VBA or the nomenclature it uses.

    Any help on a code for this would be greatly appreciated.

    Thanks

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

    Re: Splitting Data Into Separate Files Based on Pre-Populated List

    I would have a secondary sheet (Sheet2) that lists the Part Numbers (column A) and the Employee that handles that part (Column B).

    Then when the data sheet comes in, you add a column to the beginning of the data (insert column A) and put in a VLOOKUP() formula to lookup the name for each part. In A2, then copied down:

    =VLOOKUP($B2, Sheet2!$A:$B, 2, 0)

    Adding that column/Formula takes 10 seconds.

    Then a parsing macro can then split that data out onto separate sheets based on the names in column A.

    'SHEET1 TO MANY SHEETS
    Here's a 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.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Re: Splitting Data Into Separate Files Based on Pre-Populated List

    Thanks, The =VLOOKUP helped a lot, I tried to get the list to split into tabs but didn't work. I didn't spend too much time on it but ill go back and give it another shot.

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

    Re: Splitting Data Into Separate Files Based on Pre-Populated List

    If you want to post your file with your edited version of the macro in it, I can see what you might have done wrong implementing it.

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.

  5. #5
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Re: Splitting Data Into Separate Files Based on Pre-Populated List

    Dummy schedule.xls

    Dummy Name list.xls

    Dummy Schedule Problems.doc

    The two excel files are the dummy files stripped down to the essentials

    The word document are screen shots of a rough step by step process and the error i am getting with the ParseItems macro

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

    Re: Splitting Data Into Separate Files Based on Pre-Populated List

    Wow, I'm completely stumped. Your worksheet has something "illegal" in it and I have no idea what it is. Whatever it is stop the AdvancedFilter from working, period.

    Anyway, I've removed the whole section and used another method to collect all the unique values from the vCol. Now that I've seen that odd behavior, I will probably change my published macro.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 11-16-2011 at 02:45 PM. Reason: Put back in sorting capability

  7. #7
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Re: Splitting Data Into Separate Files Based on Pre-Populated List

    Awesome! works perfect on my dummy file (along with the code for Vlookup and your code to add rows) i just need to figure out how to put everything all into one macro.

    Thanks so much

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

    Re: Splitting Data Into Separate Files Based on Pre-Populated List

    Do you need to? If you have three separate sequentially working macros, create a 4th to run them all in order:

    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