LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
RC- RC- is offline
external usenet poster
 
Posts: 12
Default Clear a Carriage Return from a String Value

Excellent!

Thank you, that works perfectly!

"Dan E" wrote in message
...
This will work on the selected range, clears the cr's lf's crlf's and

leaves nothing in their place

Sub ClearCRLF()
For Each Cell In Selection
temp = Cell.Text
For i = 1 To Len(temp)
a = Mid(temp, i, 1)
If a = vbCrLf Or a = vbCr Or a = vbLf Then
temp = Left(temp, i - 1) & Right(temp, Len(temp) - i - 1)
End If
Next
Cell.Value = temp
Next
End Sub

Dan E

"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)?



Any help would be great!

RC-



BTW - I already tried the Trim function that did not work.






 
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
program carriage return MarkM[_2_] Excel Discussion (Misc queries) 3 January 23rd 08 02:36 PM
Carriage Return Freddo Excel Worksheet Functions 2 March 22nd 07 10:34 AM
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 05:29 AM.

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"