+ Reply to Thread
Results 1 to 8 of 8

New files based on column data

  1. #1
    Registered User
    Join Date
    12-11-2015
    Location
    louisville ky
    MS-Off Ver
    2010
    Posts
    22

    New files based on column data

    I admit I'm pretty lost in VBA -- but each time I've tried it I've not had much luck but I'm looking to create new files based on data in Column C of a workbook. Or if I could specific the groups like 110, 111 and 134 create a file called "whatever".xlsx and 222 and 223 "whatever2"

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: New files based on column data

    We're going to need a little more information than this. I'll assume the file names you want to create are contained in column C. What would you like in these files? What format would you like them to be in (XLSX, XLSB)? Where do you want them (same directory or some other directory)?

    And even though it would be simple enough to set up a workbook to do this, it would be better if you supply one.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    12-11-2015
    Location
    louisville ky
    MS-Off Ver
    2010
    Posts
    22

    Re: New files based on column data

    sorry -- attached is a basic file type. I was able to find one that broke them apart as tabs then created files on Mr.Excel after reading the reference material but having a way to group them by P/L (examples would be 100-199 would go to a file called 1st shift, 200-299 2nd shift, 300-399 3rd, etc.) would be amazingly valuable.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by terence17; 01-09-2019 at 05:56 PM.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: New files based on column data

    First of all, read up on how to insert code tags. I suggest you go back and put them in or a moderator may clamp down on you. They are normally nice enough to add them for you the first time, but you should learn to do it for yourself. Since I am not bothering with the code (I intend a complete re-write), I'm OK with it for now.

    Add Code Tags
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html

    Now for some additional questions. I'm looking at column C - I assume, even though there is scant data here that there should be multiple rows and that they could be 112, 113, 114, 211, 212, 311, 314, etc.

    What you want to do is group all the 100s into First Shift, All the 200s into Second shift and all the 300s into third shift. So if my sample entries were the only entries, then the rows containing 112, 113 and 114 will go into the first shift file, 211, 212 go into second shift file and 311, 314 go into third shift. Please confirm

    Another question: how is this data entered? Are you doing it manually in the workbook, or do you get this workbook from someone else? It makes a difference where I put the code. If you are doing the maintenance in this workbook, I'll put the code in this workbook. If you get a new workbook every day, then the code belongs in another workbook that opens the daily workbook and works on that.

  5. #5
    Registered User
    Join Date
    12-11-2015
    Location
    louisville ky
    MS-Off Ver
    2010
    Posts
    22

    Re: New files based on column data

    I'll fix my previous post. thanks.

    question 1 -- yes normally there are 48 different possible numbers, that would be broken down in to 5 separate groups -- I was hoping I could see how it is done and not screw it up.

    Question 2 -- The data is pulled from another source; normally emailed or directly downloaded from an internal website (Honestly I'm trying to find a solution for someone so do know the exact path I was emailed the file from them) -- normally there are just over a 1100 lines of data.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: New files based on column data

    Here is a spreadsheet that should do what you want it to do.

    Put the source file in the same directory with this file. Enter the name of the source file in Cell B1.

    In the table in columns G:I, set up the Groups you want. Whatever is in column G will be the file name of the result. So this could be Shift 1, Shift 2, etc. The only caveat here is to make sure you do not include a character that is illegal for a file name. In columns H and I, include the break points for the group. You can have as many rows as you want.

    The results will come out in the same directory as this spreadsheet.
    Attached Files Attached Files

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,926

    Re: New files based on column data

    Here is the test file I used.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-11-2015
    Location
    louisville ky
    MS-Off Ver
    2010
    Posts
    22

    Re: New files based on column data

    Wow, that is amazing the end product is exactly what I hoped for -- Thank you so much - I'm speechless.

+ 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. Split the data in new excel Files based on Column
    By sai0449 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-10-2015, 11:18 AM
  2. Splitting out Excel data to multiple files based on one column's values
    By MetroBOS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2015, 11:38 AM
  3. Macro to separate data based on contents of a column to 2 new excel files
    By beautify5 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-18-2015, 11:19 AM
  4. Downloading files based on column data.
    By X82 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-24-2012, 11:21 PM
  5. Splitting out Excel data to multiple files based on one column's values
    By machos in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2011, 08:55 AM
  6. Add data files consecutively and add a column based on the file name
    By hippie_dream in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-10-2011, 06:26 PM
  7. Saving different files based upon data in particular column
    By DKY in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-06-2005, 11:27 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