+ Reply to Thread
Results 1 to 5 of 5

Export to CSV with Macro...but getting 1,000,000+ lines

  1. #1
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    209

    Export to CSV with Macro...but getting 1,000,000+ lines

    I've got a macro that was generously created by a user on this forum. I've been using it in another sheet, and ported it to a new one I'm using.

    Basically I want to export a specific tab, but as the file can have 5 rows or 5000 (max 10,000) I want it to clear any blank lines so when I import the file into our POS it won't try and import a bunch of blank lines.

    Anyhow, with this formula now I'm getting an error opening the file (what has 8 rows I think) that it exceeds the 1 million lines error. Can anyone view the code and see if its possible to mod it better to remove all blank lines?

    Thanks!

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    209

    Re: Export to CSV with Macro...but getting 1,000,000+ lines

    Ok. I the problem was in my sheet. Not with the code. I had changed some "if" statements so that they would return "" instead of 0. That cleared up the millions of blank rows.

    Now I'm getting still one blank row at the bottom. Its not visible as such when your looking at it...only when I go to import it into our POS application it will come in as a blank line. This is something with the code I'm certain.

    I can edit the csv, simple delete the row under the last one with values, save over top of it and re-import and it won't bring in a blank line.

    What would be the best way to fix this? Can someone add the code to remove one line minus the count with values...or clean up the above code to actually remove all blank lines?

    Thanks :-)

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb Mod to apply …


    Hi !

    Just try this mod : Print #1, txt;

    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  4. #4
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    209

    Re: Export to CSV with Macro...but getting 1,000,000+ lines

    OOooh. Thats good! How does that work? Was the code incorrect?

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Export to CSV with Macro...but getting 1,000,000+ lines


    No, I just add the part you forgot to tell to the generous original author …

    Thanks for the rep' !
    Last edited by Marc L; 04-13-2018 at 08:17 PM.

+ 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] Export in other sheet , loop (skipping lines in between) and populating data
    By guibro in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-18-2015, 08:19 AM
  2. [SOLVED] Export to CSV writes extra 130 lines of commas
    By dubcap01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2015, 05:09 AM
  3. [SOLVED] count total number of lines in big text files and export results for each txt to sheet
    By jtammyg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-07-2014, 05:37 AM
  4. Replies: 0
    Last Post: 03-19-2014, 10:33 PM
  5. Export from Sage to Excel, Macros and number of lines necessary
    By jordangardner54 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-19-2013, 11:02 AM
  6. I would need a macro to export data from base example workbook to export worbook
    By slato8 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2012, 11:21 AM
  7. [SOLVED] Excel 2000 data export is missing lines, adds horizontal cells
    By gotmerit55 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-22-2006, 01:20 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