Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Carriage return CWH Excel Discussion (Misc queries) 1 March 16th 10 01:54 PM
Can I insert 'carriage/line returns' in text string? DC-Frank Excel Worksheet Functions 1 June 16th 08 04:54 PM
Carriage Return Freddo Excel Worksheet Functions 2 March 22nd 07 10:34 AM
Clear a Carriage Return from a String Value RC- Excel Programming 0 August 5th 03 09:54 PM
Clear a Carriage Return from a String Value JS[_4_] Excel Programming 0 August 5th 03 09:47 PM


All times are GMT +1. The time now is 12:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"