Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default special character - line feed

How can I find a line-feed (alt + Enter) in a text cell in Excel and replace it with a space. When we save our Excel data to .csv and upload, our application bombs with this special character.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default special character - line feed


-----Original Message-----
How can I find a line-feed (alt + Enter) in a text cell

in Excel and replace it with a space. When we save our
Excel data to .csv and upload, our application bombs with
this special character.
.

Chris

Something like this

Sub Macro1()
Dim x
Dim c As Variant
x = Chr(10)
For Each c In Selection
c.Replace What:=x, Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Next c
End Sub

Regards
Peter
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default special character - line feed

replace works on a range, why do selection.count -1 useless loops.

Sub Macro1()
Cells.Replace What:=Chr(10), Replacement:=" ", _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False
End Sub

--
Regards,
Tom Ogilvy


"Peter atherton" wrote in message
...

-----Original Message-----
How can I find a line-feed (alt + Enter) in a text cell

in Excel and replace it with a space. When we save our
Excel data to .csv and upload, our application bombs with
this special character.
.

Chris

Something like this

Sub Macro1()
Dim x
Dim c As Variant
x = Chr(10)
For Each c In Selection
c.Replace What:=x, Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Next c
End Sub

Regards
Peter



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
Challenge - Excel Line Feed Character CHR(10) - How to Delete and keep the text formatting without going ro single line in a cell ? No Name Excel Worksheet Functions 7 October 7th 09 11:10 AM
Fonts & Line Feed in a Cell Mark B Excel Discussion (Misc queries) 4 February 8th 07 06:50 PM
Life Feed character ArthurJ Excel Worksheet Functions 3 October 22nd 06 11:03 PM
Replace Line Feed nsv Excel Discussion (Misc queries) 7 February 16th 06 05:37 PM
How to put line feed in a cell using a character not Alt/Enter David Crowther Excel Discussion (Misc queries) 1 October 3rd 05 06:59 PM


All times are GMT +1. The time now is 03:35 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"