+ Reply to Thread
Results 1 to 10 of 10

Creating Smaller Lists from a Big List

  1. #1
    Registered User
    Join Date
    05-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Creating Smaller Lists from a Big List

    I have a file with about 10,000 entries that I need to break into separate files of no more than 100 lines each. I also need to spit them out in CSV with double quotes ala this macro:

    http://www.markinns.com/articles/ful..._double_quotes

    Is there a way to do this with scripting? (I am a VBA and excel novice).

    Thanks.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Creating Smaller Lists from a Big List

    Like so:

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 05-01-2012 at 03:07 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

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

    Re: Creating Smaller Lists from a Big List

    try
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Re: Creating Smaller Lists from a Big List

    Thanks for the fast response but both macros hang up on the file. I've attached a test file that might help explain the format. Thanks.

    test_template.xls

  5. #5
    Registered User
    Join Date
    05-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Creating Smaller Lists from a Big List

    I was able to get JBeaucaire script to work kind of. I have a file with 8700 or so rows. When the macro runs it asks How many rows to export per file? which is defaulted at 10. When I change it to 100 I still get 870 data files that seem to have 90 rows from the previous one. Am I doing something wrong?

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Creating Smaller Lists from a Big List

    My apologies! I've corrected the code above... highlighted the correction in red.

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

    Re: Creating Smaller Lists from a Big List

    Hung up?

    try this one
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-01-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Creating Smaller Lists from a Big List

    @jindon

    Runtime error 70

    It doesnt like this line:

    Open CreateObject("WScript.Shell").Specialfolders("desktop") & "\testLast.csv" For Output As #1

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

    Re: Creating Smaller Lists from a Big List

    Then change to this.
    Please Login or Register  to view this content.
    PS.
    That line should be
    Please Login or Register  to view this content.
    Without "\" path separater.
    Last edited by jindon; 05-01-2012 at 04:45 PM.

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Creating Smaller Lists from a Big List

    Did you try the highlighted correction from post #2?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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