+ Reply to Thread
Results 1 to 6 of 6

Split CSV Worksheet into Multiple CSV Files

  1. #1
    Registered User
    Join Date
    04-19-2013
    Location
    Cheshire, UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Split CSV Worksheet into Multiple CSV Files

    Hi.
    Ive been looking through the various posts on the forums and have tried a few bit of code which are almost doing what I need but my VB is pants to be honest, so I'd like some help if that's possible.

    I found this post from yesteryear http://www.excelforum.com/excel-gene...s-by-rows.html which is pretty much what I need HOWEVER, the code here uses the first row as the header row (same as me) but then only takes the 2nd row into the new files. It works perfectly for that, but I need to extend the number of rows.

    So rather than it being the header and one row, I need the header and 2000 rows, saving to each new workbook. The workbook I have, has just over 87,000 rows.

    I'm sure the code on the above thread can be adapted by someone smarter than me, I just can figure it out I'm afraid.

    Thanks for reading. Look forward to hearing any answers.

    Chris

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Split CSV Worksheet into Multiple CSV Files

    This should do.
    Change fn to actual file path of Original csv.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-19-2013
    Location
    Cheshire, UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Split CSV Worksheet into Multiple CSV Files

    Thanks for the reply Jindon, the code works great but is there away to also copy the header (row 1) from the original worksheet into all the other sheets at the same time? Similar to the other thread code "FirstRow = 2 'headers in row 1" kind of thing. Thanks again

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Split CSV Worksheet into Multiple CSV Files

    It should add the header to each newly created csv if you have header in the first row in the original csv.

    And it is working here as it should be....

  5. #5
    Registered User
    Join Date
    04-19-2013
    Location
    Cheshire, UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Thumbs up Re: Split CSV Worksheet into Multiple CSV Files

    Sorry Jindon. My bad. yes, it works perfectly. Thanks very much for your time

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Split CSV Worksheet into Multiple CSV Files

    That's OK and glad it is working.

+ 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