+ Reply to Thread
Results 1 to 4 of 4

Split data from one excel spreadsheet and export to multiple text files

  1. #1
    Registered User
    Join Date
    07-02-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Split data from one excel spreadsheet and export to multiple text files

    Hi, I am new to writing VBA and need some help solving a particular problem.

    Firstly, my advance apologies if this has been covered in a previous string - my search didn't bring up what I was looking for.

    I have attached my sample dataset, basically it is one sheet with two fields. The first field is the group in this case being department type. The second field is a series of numbers - a series of employee id numbers for each of the different departments.
    Departments and employees.xlsx
    I need to split each department and respective list of employee numbers into individual sheets (can be the same workbook). Each sheet will be named according to the respective department name but will only contain the list of employee id numbers pertaining to that department without a title row. From there I need to export each sheet into a text file, the file name being the name of the worksheet (i.e. fruit type) and contents of the file being the list of serial numbers. The number of different departments could change each month so it needs to be flexible to allow for new departments and volume of employee id numbers per department.

    I've found a piece of code to split the data - it can kind of do what I need but keeps the group field and title rows in the individual sheets, unfortunately I cannot understand the code well enough to remove the titles and group fields.

    Any help would be most gratefully received.

    Thanks in advance

    Jamie

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Split data from one excel spreadsheet and export to multiple text files

    Hi,

    This should do the trick

    Please Login or Register  to view this content.
    Please take time to read the forum rules

  3. #3
    Registered User
    Join Date
    07-02-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Split data from one excel spreadsheet and export to multiple text files

    Thank you very much for your help Steffan, it is much appreciated. The code does exactly what I need it to, I've just added an extra piece to create a new folder with a user defined date each time the macro is run.

  4. #4
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Split data from one excel spreadsheet and export to multiple text files

    Glad i could help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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