ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Squares (https://www.excelbanter.com/excel-programming/334921-squares.html)

MSL[_2_]

Squares
 
Whenever i copy text from a text box to a cell, all new lines appear with a
square at the end of it. Anyone know how to stop these squares from
appearing.
Many thanks,

Gareth[_6_]

Squares
 
I suspect this is because the new lines in the textbox are created with
a carriage return and line feed (CHR(13) & CHR(10)) whereas the Excel
cells just use a line feed (CHR(10)). (Although I can't recreate the
problem you experience manually.)

You can clean out the CHR13s by using Replace e.g.
cells("A1") = replace(cells("A1"),vbcr,"")

Replace is only available in Excel 2000 and greater. (You can use athe
worksheet function replace if you're running XL97).

Note however you don't need to do this if you don't copy text and use
code such as:
Cells(1, 1) = TextBox3.Text
to place the text directly in a cell.

HTH,
Gareth

MSL wrote:
Whenever i copy text from a text box to a cell, all new lines appear with a
square at the end of it. Anyone know how to stop these squares from
appearing.
Many thanks,



All times are GMT +1. The time now is 01:21 AM.

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