+ Reply to Thread
Results 1 to 6 of 6

Divide a worksheet in two and save as discreet csv files

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Divide a worksheet in two and save as discreet csv files

    Hi All

    I need to divide my worksheet in two , and save each half to a named
    directory as discreet CSV files named part 1 and part 2.

    As the amount of lines is variable , it would need to work out the half-way
    point and divide there , so saving out the top half and bottom halves.
    Headers would need to be present in both.

    Can someone help with this?

    Best wishes

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Divide a worksheet in two and save as discreet csv files

    Perhaps something like this could work for you?

    Macro assumes data starts on row 1

    Please Login or Register  to view this content.
    Alf
    Last edited by Alf; 04-09-2015 at 11:53 AM. Reason: change made to code

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Divide a worksheet in two and save as discreet csv files

    Hi Alf

    Ok thanks for this.

    I gave it a go an it's nearly there. It needs to save as csv please , and could name the two parts as 'part one' and 'part two'. I think also , rather than hiding the two halves it could delete so that the two saved parts have the header rows in place and the top and bottom rows in place.

    For example this :

    First Name Second Name

    John Smith
    Jill Jones
    Bill Rodgers
    Emily Johns

    Would become (part 1.csv)


    First Name Second Name

    John Smith
    Jill Jones


    and (part 2.csv)

    First Name Second Name

    Bill Rodgers
    Emily Johns


    Sorry if my first post was not clear enough , but I'm grateful for your help.

    Best Wishes ,

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Divide a worksheet in two and save as discreet csv files

    No problem, I've added the save as csv part and you need to change the "C:\Test\" part to the drive and folder where you wish to save the result.

    This macro will not make any changes to the "master file"

    Please Login or Register  to view this content.
    Alf

  5. #5
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Divide a worksheet in two and save as discreet csv files

    Hi Alf

    Ok that worked perfectly first time - thanks!

    I'm grateful for your time and expertise.

    Best Wishes ,

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Divide a worksheet in two and save as discreet csv files

    You are welcome and thanks for feed back.

    If this solves your problem don't forget to mark thread solved.

    Alf

    Ps
    To mark your thread solved do the following:
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

+ 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. Divide worsheet and save as separate files
    By Colin Hayes in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  2. [SOLVED] Divide worsheet and save as separate files
    By Colin Hayes in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 AM
  3. [SOLVED] Divide worsheet and save as separate files
    By Colin Hayes in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  4. [SOLVED] Divide worsheet and save as separate files
    By Colin Hayes in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  5. [SOLVED] Divide worsheet and save as separate files
    By Colin Hayes in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM

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