+ Reply to Thread
Results 1 to 10 of 10

Split Large Excel XLSX File Into Multiple XLS Files

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    South Dakota
    MS-Off Ver
    Office Mac 2011
    Posts
    4

    Split Large Excel XLSX File Into Multiple XLS Files

    I am working with a large XLSX file 100K+ rows and I need to split it into smaller XLS files of 10K rows. Searching this forum, I found the code below for a macro that almost does what I need it to do, but I need it tweeked so that it will save it as an XLS file and I also want to change the naming structure to File1, File2, ect. Can anyone help with this?

    Please Login or Register  to view this content.
    Last edited by EnormousRA; 10-05-2013 at 03:39 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    Welcome to the Forum!

    First a couple of notes. We have a forum specifically for VBA issues, so I have moved the thread there. Second, your PHP tag gets the job done but you'll see that it also provides color coding that you may or may not find useful. We also have a CODE tag that preserves spacing without color coding.

    Now then, I have made the change below as highlighted and have tested it. Close allows you to save the file with a different name but offers no option for selecting a different format. To do that you must use SaveAs, and then Close afterwards. xlExcel8 means Excel 97-2003, and is a built-in constant with a value of 56.

    Note that the code you provided copies Row 1 as a header into all the split files. I'm assuming that's what you want.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-26-2012
    Location
    South Dakota
    MS-Off Ver
    Office Mac 2011
    Posts
    4

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    Thank you, this is exactly what I was looking to do. One other quick question, how does it determine where the file is being saved? Right now it seems to be saving it in a different folder than the excel file is in.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    Ah, the value of giving a complete description in the first post....

    Change this line to:
    Please Login or Register  to view this content.
    However, I do not have a Mac to test this on.

  5. #5
    Registered User
    Join Date
    09-26-2012
    Location
    South Dakota
    MS-Off Ver
    Office Mac 2011
    Posts
    4

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    I guess it doesn't like this code on my Mac. It gives a compile error. I attached a screenshot below.

    Screen Shot 2013-10-05 at 11.20.54 AM.jpg

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    I'm very sorry. Change PathName to Path.

  7. #7
    Registered User
    Join Date
    09-26-2012
    Location
    South Dakota
    MS-Off Ver
    Office Mac 2011
    Posts
    4

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    Thank you for the help. Your code was close, and I got it figured out from there. I posted the finished working code below.

    Please Login or Register  to view this content.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    Thanks for posting the completed code. I also did a little research and found that the directory delimiter on a Mac is ":". Good catch.

  9. #9
    Registered User
    Join Date
    08-23-2016
    Location
    Ottawa, Canada
    MS-Off Ver
    2013
    Posts
    1

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    Hi guys, I get a run-time error '1004' Application-defined or object-defined error and just one output file of in my case 65k lines from a 639k .xslx. Any ideas appreciated..
    Last edited by jochap; 08-23-2016 at 09:58 AM.

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Split Large Excel XLSX File Into Multiple XLS Files

    jochap, even though your question is a follow-up, the original question has been solved, yours is a new problem and you should start a new thread. You should also attach your file so we can see what code you are using.

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

+ 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. [SOLVED] Split Large Excel file to multiple excel files
    By kambeng02 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-24-2021, 01:11 AM
  2. [SOLVED] Split Large Excel file to multiple excel files and possible save the files
    By EnzioL in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-20-2012, 03:28 AM
  3. Split large file into several smaller xls files
    By dirre in forum Excel General
    Replies: 4
    Last Post: 10-27-2011, 08:13 AM
  4. Replies: 4
    Last Post: 09-22-2010, 01:22 PM
  5. Split large spreadsheet into multiple files
    By jason102 in forum Excel General
    Replies: 8
    Last Post: 07-25-2008, 03:50 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