Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to remove the 'carriage return' or 'line feed' from a text file.
I tried using the RIGHT and MID commands but it is not working. I have searched the community website for examples but could not find any. Could someone please help me out. Thank you. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Replace(strData,vbLF,"") for linefeed
Replace(strData,vbCrLF,"") for CRLF If this post helps click Yes --------------- Jacob Skaria "Francis Ang" wrote: I am trying to remove the 'carriage return' or 'line feed' from a text file. I tried using the RIGHT and MID commands but it is not working. I have searched the community website for examples but could not find any. Could someone please help me out. Thank you. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you Jacob and RyGuy. Your suggestions work like a charm. Thank you
again. "Jacob Skaria" wrote: Replace(strData,vbLF,"") for linefeed Replace(strData,vbCrLF,"") for CRLF If this post helps click Yes --------------- Jacob Skaria "Francis Ang" wrote: I am trying to remove the 'carriage return' or 'line feed' from a text file. I tried using the RIGHT and MID commands but it is not working. I have searched the community website for examples but could not find any. Could someone please help me out. Thank you. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can try a few things...
Delete All Hard Returns: Sub Remove_CR_LF() With Selection ..Replace What:=Chr(39), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False ..Replace What:=Chr(146) & Chr(10), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False ..Replace What:=Chr(180), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False End With End Sub Sub Remove_CR_LF() With Selection ..Replace What:=Chr(160), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False ..Replace What:=Chr(13) & Chr(10), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False ..Replace What:=Chr(10), Replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False End With End Sub I think those are ASCII Chr(13); yo may have other things in there too... Backup your data before running any macros, just in case the results are unintended... HTH, Ryan--- "Francis Ang" wrote: I am trying to remove the 'carriage return' or 'line feed' from a text file. I tried using the RIGHT and MID commands but it is not working. I have searched the community website for examples but could not find any. Could someone please help me out. Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? | Excel Worksheet Functions | |||
How do I insert a line break (carriage return) in text in a cell? | Excel Discussion (Misc queries) | |||
How do I remove multiple line feed(s) or carriage return(s)? | Excel Discussion (Misc queries) | |||
Find/Replace carriage return & line feed characters in Excel. | Excel Worksheet Functions | |||
how does excel store new line and line feed characters? | Excel Programming |