Replacing alt-enter (think chr(10)) with other text
I'm a little out of practice and need some help.
I need a macro to replace chr(10) -( the result of using alt-enter when editing a cell) in value cells with a string "xxxx" or whatever. I know this is basically easy, but could use some help. I'm not sure if I would have to navigate through all cells, and look one character at a time and when I find this to replace it, or if there is another way. Certainly can't figure out how to do it with find and replace. Thanks, Andy Kessel |
Replacing alt-enter (think chr(10)) with other text
Oh never mind I found the answer. already in group. this worked great
Sub ReplaceNonPrintableCharacter() ' Use =CODE(MID(a,b,1)) to get the character ' code # of the offending character where ' a = text string ' b = character's position in string 'a' ' Ex: The above formula returns a 10 for a linefeed. ' The following replaces linefeeds with spaces. ' Replace the 10, if necessary, for your situation. Cells.Replace _ What:=Chr(10), _ Replacement:="<br", _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ MatchCase:=False End Sub |
All times are GMT +1. The time now is 04:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com