+ Reply to Thread
Results 1 to 24 of 24

How Do I Get Rid of Carriage Returns?

  1. #1
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    How Do I Get Rid of Carriage Returns?

    When I save my file as text and upload into a program, I get a response saying that my file can't be processed due to carriage returns. What are these things and how do I get rid of them? My excel file has about 6000 rows and 50 columns of data.
    Last edited by Ocean Zhang; 07-02-2009 at 10:49 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: How Do I Get Rid of Carriage Returns?

    Isn't CarriageReturn 013 ?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: How Do I Get Rid of Carriage Returns?

    No worries.

  4. #4
    Registered User
    Join Date
    06-01-2009
    Location
    India
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    66

    Lightbulb Re: How Do I Get Rid of Carriage Returns?

    Hey guys,

    Can you guys please check - I think carriage return has code as 010 (I have confirmed this on my side)

    Please confirm.
    Mohit Khurana, CFA

    Excel Matic - A blog on MS Excel

    List of Essential Excel Shortcuts

    e-Book on Excel Math Functions

    Please add to our reputation if you find our replies as helpful.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: How Do I Get Rid of Carriage Returns?

    No LineFeed has a value of 10.

  6. #6
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How Do I Get Rid of Carriage Returns?

    I tried the steps with Ctrl-H, Alt 015, replace all, and Alt013 replace all, but I can't tell if it works because I can't spot any carriage returns.

    I've attached my files. If you can point out to me where those carriage returns are, I'd really appreciate it.

    Also, how exactly would I use the Clean() formula?

    Thanks
    Ocean
    Attached Files Attached Files

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How Do I Get Rid of Carriage Returns?

    It's hard to see from the file you attached... looks like you cleaned them...

    Perhaps attach original file too...?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  8. #8
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How Do I Get Rid of Carriage Returns?

    strange... I can't get to the original until later tonight.

    I grabbed the text file that failed to validate due to carriage return issues, opened it with excel, saved it as .xlsx, and attached it to this forum. I didn't attempt to clean that one. Strange.

  9. #9
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How Do I Get Rid of Carriage Returns?

    would the process of saving it as text, then converting the text file back to xlsx clean up carriage returns?

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How Do I Get Rid of Carriage Returns?

    It's hard to see from the file you attached..
    Cell M403, for example.

    If you want to delete them all, do Alt+F11 to open the VBE, Ctrl+G to open the Immediate window, and enter

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How Do I Get Rid of Carriage Returns?

    Well, I didn't look as thoroughly as shg did .

    .. but hopefully his solution works for you.

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How Do I Get Rid of Carriage Returns?

    Well, I didn't look as thoroughly as shg did.
    Please Login or Register  to view this content.

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How Do I Get Rid of Carriage Returns?

    Thanks shg... will remember for next time I hope... as you know, VBA route is not my forte

  14. #14
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How Do I Get Rid of Carriage Returns?

    sorry for the REALLY dumb question, but what do I do after I put the code cells.replace chr(13), "" into the Immediate window of the Visual Basic thingy?

  15. #15
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How Do I Get Rid of Carriage Returns?

    Hit Enter.

  16. #16
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How Do I Get Rid of Carriage Returns?

    wonderful. Thanks so much. I guess the carriage return didn't look like anything. It just took up an extra line of space.

    does the code cells.replace chr(13), "" have any potential hazards, or does it only get rid of the carriage returns?

    Thanks!

  17. #17
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How Do I Get Rid of Carriage Returns?

    It only gets rid of carriage returns, but it will only work in cells with 1024 or fewer characters.

  18. #18
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How Do I Get Rid of Carriage Returns?

    when i run:

    cells.Find(chr(13)).Select

    I get an error Run-time error 91: Object variable or With block variable not set.

    What does that mean? After running cells.replace chr(13), "" in the attached sheet, but I still get a message from the site that I'm uploading to that the file contains extra carriage returns
    Attached Files Attached Files

  19. #19
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: How Do I Get Rid of Carriage Returns?

    Usually, what you have been referring to as ' carriage return' is called carriage return-linefeed (CRLF) and consists of two characters, namely, hex(0D), the carriage return code, and hex(0A) the linefeed code. As far as I know, they are always used together:

    The carriage return hex(0D) = chr(13) causes the print head/cursor to move to the extreme left of the paper/screen.

    The linefeed code hex(0A) = chr(10): For printers, it moves the paper UP one line. For for the screen, it moves the cursor DOWN one line. If you look at a text file in a hex editor you will always see them paired: 0D0A.

    So try a replace for all 0D's, ie. chr(13) and 0A's (chr(10))...
    Ben Van Johnson

  20. #20
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How Do I Get Rid of Carriage Returns?

    That was beautiful. Thanks so much!

+ 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