ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Truncating trailing Chr(10) in Cell w/ Len() 256 w/o losing Format ... (https://www.excelbanter.com/excel-programming/394721-truncating-trailing-chr-10-cell-w-len-256-w-o-losing-format.html)

Joe HM

Truncating trailing Chr(10) in Cell w/ Len() 256 w/o losing Format ...
 
Hello -

I need to truncate trailing Chr(10)s from a cell that contains more
than 256 characters. The following will not work in that case ...

If Mid(ActiveSheet.Cells(1, 1).Value, Len(ActiveSheet.Cells(1,
1).Value)) = Chr(10) Then
ActiveSheet.Cells(1, 1).Characters(Start:=Len(ActiveSheet.Cells(1,
1).Value), Length:=1).Delete
End If

.... if the cell contains more than that limit. I know that I could
use the Cells().Value to do this but then I would lose all the
formatting within that cell (e.g. bolded words).

Is there any way to do this withoug losing the formatting?

Thanks!
Joe



All times are GMT +1. The time now is 06:58 AM.

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