LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Replace manual line breaks (Alt+Enter) with two spaces forselectedcells

On Mar 21, 12:26*pm, joel wrote:
The return in the cell is code as an ascii character Linefeed which is
a 10. In the code below I set a variable to character 10. *You can also
use vblf. *You can use any string method with the linefeed like REPLACE
to remove the character or replace the character with other characters

LF = Chr(10)
or
LF = vbLF

with
Set c = .Columns("A").Find(what:=LF, _
LookIn:=xlValues, lookat:=xlPart)
if not c is nothing
FirstAddr = c.address
do
c = replace(c,LF, " *")
set c = .Columns("A").findnext(after:=c)
while not c is nothing and c.address < FirstAddr

end if
end with

The code below is complicated. *I just wanted to show a couple of
different methods. *I don't know how many cells you are trying to replce
the Linefeed with two spaces. *You can achieve the same thing as
follows

LF = vbLF

with sheets("sheet1")
.columns("A").replace(LF," *")

end with

--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=189290

http://www.thecodecage.com/forumz/chat.php


Hi Joel,

great help. Thank you very much for your professional advice. It works
as desired.

Regards, Andreas

 
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
Alt-Enter Line Breaks Keven Denen Excel Discussion (Misc queries) 2 October 7th 09 04:37 PM
Removing Manual Line Breaks in Multiple Cells Jules Excel Discussion (Misc queries) 2 January 30th 09 08:09 PM
Remove Manual Line Breaks in Cell prizm Excel Discussion (Misc queries) 3 June 13th 07 04:41 PM
How do I insert manual line breaks in excel? sldwrks84 Excel Worksheet Functions 2 January 12th 06 04:49 PM
manual line breaks cwee Excel Discussion (Misc queries) 2 April 21st 05 05:48 PM


All times are GMT +1. The time now is 05:56 AM.

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

About Us

"It's about Microsoft Excel"