Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clear a Carriage Return from a String Value
Depends on how you use the TRIM function. You want to
first convert some characters to spaces. See the TRIMALL macro in http://www.mvps.org/dmcritchie/excel/join.htm#trimall you can make the following changes permanent or make another macro with a slightly different name. 'Also Convert CR and LF to a Space (CHR 032) Selection.Replace what:=Chr(13), replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False Selection.Replace what:=Chr(10), replacement:=Chr(32), _ LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False use the worksheet version of TRIM to replace consecutive inner spaces by a single space. i.e. application.TRIM Better use a copy of your worksheet until you know it is working properly with your VLOOKUP. You do not want to mess up something that worked with a data base because it used and required some strange characters. --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "RC-" wrote in message ... Hi All, I have a string in a cell that has a Carriage Return in it. I'm trying to perform a Vertical Lookup and it's not working because of the CR. How can I programmatically remove the CR from the String(s)? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Carriage return | Excel Discussion (Misc queries) | |||
Can I insert 'carriage/line returns' in text string? | Excel Worksheet Functions | |||
Carriage Return | Excel Worksheet Functions | |||
Clear a Carriage Return from a String Value | Excel Programming | |||
Clear a Carriage Return from a String Value | Excel Programming |