+ Reply to Thread
Results 1 to 5 of 5

Extra trailing commas in exported CSV

  1. #1
    Registered User
    Join Date
    07-24-2006
    Posts
    6

    Extra trailing commas in exported CSV

    Hi All

    I have some VBA that exports a sheet from my workbook as a CSV file. I do some cleaning up on the sheet before it is exported:

    wksCSV.Range("H2:AA65536").Clear
    wksCSV.Range("A2:AA65536").ClearFormats

    Despite this I consistently get two extra trailing commas on rows 2 to 16 (first row is a header, which is longer) in the resulting CSV (as if H2:I16 contained something).

    Any suggestions?

    T,123456789,,A COMPANY LTD,X,D,250706,0506,CSV01
    84289000,,DDP,,,,IT,,
    84289000,,DDP,,,,FR,,
    84289000,2094.44,DDP,10,17,,DE,,
    84289000,2574.97,DDP,10,53,,FR,,
    84289000,2394.83,DDP,,,,IT,,
    84289000,2805.87,DDP,10,6,,IT,,
    84289000,1008.1,DDP,,,,NL,,
    84289000,945.27,DDP,,,,NL,,
    84289000,92.65,DDP,10,0.5,,ES,,
    84289000,636.99,DDP,10,10,,IT,,
    84289000,7833.33,DDP,,,,DE,,
    84289000,67.12,DDP,10,0.5,,FR,,
    84289000,1318.33,DDP,10,1.5,,FR,,
    84289000,431.61,DDP,10,2,,SE,,
    84289000,112.64,DDP,10,0.3,,FR,,
    84289000,67.12,DDP,,,,FR
    84289000,1969.53,DDP,,,,IT
    84289000,479.93,DDP,10,14,,DE
    84289000,3587.6,DDP,10,92,,ES
    84289000,93.33,DDP,,,,SE
    84289000,971.83,DDP,,,,BE
    84289000,3181.43,DDP,10,12.5,,FR
    84289000,161.5,DDP,10,0.5,,SE
    84289000,171.91,DDP,10,0.3,,FR
    84289000,2200,DDP,,,,
    84289000,1347.35,DDP,,,,IT
    84289000,480,DDP,,,,DE
    84289000,617.57,DDP,10,0.5,,FR
    84289000,545.65,DDP,10,10,,NL
    84289000,484,DDP,10,3.5,,IT
    84289000,466.26,DDP,10,18,,IT
    84289000,523.83,DDP,10,18,,IT
    Last edited by lucidr; 07-25-2006 at 06:43 AM.

  2. #2
    Forum Contributor
    Join Date
    03-24-2004
    Location
    Edam Netherlands
    Posts
    181
    You will get as many comma's as columns
    The number of columns is set by the header row

  3. #3
    Registered User
    Join Date
    07-24-2006
    Posts
    6
    This doesn't happen for rows beyond row 16. Does Excel do this in chunks of 16 rows maybe? Another great bit of 'design'...

  4. #4
    Dave Peterson
    Guest

    Re: Extra trailing commas in exported CSV

    You have another response at your original thread.

    lucidr wrote:
    >
    > Hi All
    >
    > I have some VBA that exports a sheet from my workbook as a CSV file. I
    > do some cleaning up on the sheet before it is exported:
    >
    > wksCSV.Range("H2:AA65536").Clear
    > wksCSV.Range("A2:AA65536").ClearFormats
    >
    > Despite this I consistently get two extra trailing commas on rows 2 to
    > 16 (first row is a header, which is longer) in the resulting CSV (as if
    > H2:I16 contained something). Any suggestions?
    >
    > --
    > lucidr
    > ------------------------------------------------------------------------
    > lucidr's Profile: http://www.excelforum.com/member.php...o&userid=36699
    > View this thread: http://www.excelforum.com/showthread...hreadid=564635


    --

    Dave Peterson

  5. #5
    Dave Peterson
    Guest

    Re: Extra trailing commas in exported CSV

    Very good!

    lucidr wrote:
    >
    > This doesn't happen for rows beyond row 16. Does Excel do this in chunks
    > of 16 rows maybe? Another great bit of 'design'...
    >
    > --
    > lucidr
    > ------------------------------------------------------------------------
    > lucidr's Profile: http://www.excelforum.com/member.php...o&userid=36699
    > View this thread: http://www.excelforum.com/showthread...hreadid=564635


    --

    Dave Peterson

+ 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