ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replace return of line by a space in VBA (https://www.excelbanter.com/excel-programming/280969-replace-return-line-space-vba.html)

keawee[_3_]

Replace return of line by a space in VBA
 
Hello,

I would like to have your assistance In VBA

I have my data which starts in D5 until D156. In each cell, I have an
address and in several addresses, I have a return to the line.

My question. It is possible to detect in a string a return to the line
in VBA and to replace it by a space.

I have also another problem. In the address, I have some times several
space between two words, is it possible to count the number of space
between two words in if there is more than one space, then to remove
the others not to have but one.

Thanks for your help

Keawee



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Bob Phillips[_5_]

Replace return of line by a space in VBA
 
Keawee,

Try this

Replace(ActiveCell.Value, Chr$(10), " ")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"keawee" wrote in message
...
Hello,

I would like to have your assistance In VBA

I have my data which starts in D5 until D156. In each cell, I have an
address and in several addresses, I have a return to the line.

My question. It is possible to detect in a string a return to the line
in VBA and to replace it by a space.

I have also another problem. In the address, I have some times several
space between two words, is it possible to count the number of space
between two words in if there is more than one space, then to remove
the others not to have but one.

Thanks for your help

Keawee



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com