+ Reply to Thread
Results 1 to 4 of 4

Split Worksheet to multiple workbooks

  1. #1
    Registered User
    Join Date
    07-03-2012
    Location
    NC
    MS-Off Ver
    Excel 2003
    Posts
    2

    Split Worksheet to multiple workbooks

    Hi all,

    I haven't had to do much VBA code in excel and I now have a project where I need to do so. Here is my scenario:

    I have a XLS file that contains a button that executes some VBA. The vba then opens another xls file containing the Data I need to split into multiple files.
    Header row:
    Policy # | CSV | Underlying CSV | Curr DB | GCR | COI | FEES | Bank Code | CARRIER SHORT NAME | Parent Company Short Name | Case Date

    Data Rows:
    0044562 | 1,034,312.14 | 1,572,154.45 | 3.85 | 769.52 | 5.25 | 91454 | ARAB | MASS | 09282001
    0045644 | 312,198.80 | 615,031.64 4.15 | 150.99 | 5.25 | 91493 | ASSO| MASS | 06112001

    Carrier Short Name, Parent Company Short Name and Case Date will essentially be the filters. So when those match they go to a file with the name of: ARAB_MASS09282001.xls which is those 3 columns. I'm having trouble being able to split the data based on 3 columns and save them to the new file name. Any help would be greatly appreciated. If you need any more info let me know.

    Regards,

    J

  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: Split Worksheet to multiple workbooks

    'ONE SHEET to WORKBOOKS (1)
    Here's a base macro for taking a sheet with data and creating individual wbs from each unique value in a chosen column. The date is added to the workbook names to give a reference as to when the wbs were created.


    To apply this to your data, I think the solution is to add this formula to the next empty column. Based on your example I'm guessing that is column L. So in L2 you would put this formula to concatenate your thress values into a single value:

    =I2 & "_" & J2 & K2 & ".xls"

    Now copy that formula down the whole dataset and you're ready to run the macro. Here's an edited version of the macro above:

    Please Login or Register  to view this content.
    _________________
    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
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Split Worksheet to multiple workbooks

    How'd that work for you?

    If that takes care of your need, please select Thread Tools from menu above and set this topic to SOLVED.

  4. #4
    Registered User
    Join Date
    07-03-2012
    Location
    NC
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Split Worksheet to multiple workbooks

    JB - I just got back from vacation so I am looking at this now. I will let you know how I fared. Thanks!

+ 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