![]() |
Search for hexadecimal values
Need to replace hard return with <br in excel file.
Triede to search and replace for hexadecimal value for hard return (0D 0A) like: Cells.find(What:="&HoD+&H0A", . Won't work. Any ideas or suggestions are appreciated. Regards Lars Christensen. |
Search for hexadecimal values
You are actually searching for the string "&H0D+&H0A" instead of a carriage
return. Use Chr() to get the string representation of a Hex value (e.g. Chr(&H0D) & Chr(&H0A)), a more useful way for a carriage return or line feed or both is to use the constants provided with VBA (vbCr - Carriage Return, vbLf - Line Feed, vbNewLine or vbCrLf - combination of both). so Cells.Find(What:=vbCrLf,.... When you enter a carriage return directly into excel (using Alt+Enter) the actual code used is just a line feed so you will need to use Cells.Find(What:=vbLf,... Hope this is useful. Alan "Lars Christensen" wrote in message ... Need to replace hard return with <br in excel file. Triede to search and replace for hexadecimal value for hard return (0D 0A) like: Cells.find(What:="&HoD+&H0A", . Won't work. Any ideas or suggestions are appreciated. Regards Lars Christensen. |
Search for hexadecimal values
It actually worked! I have been working late with this
problem the last couple of days - and your suggestion worked perfect. I will sleep a lot better tonight - thank you. Lars. -----Original Message----- You are actually searching for the string "&H0D+&H0A" instead of a carriage return. Use Chr() to get the string representation of a Hex value (e.g. Chr(&H0D) & Chr(&H0A)), a more useful way for a carriage return or line feed or both is to use the constants provided with VBA (vbCr - Carriage Return, vbLf - Line Feed, vbNewLine or vbCrLf - combination of both). so Cells.Find(What:=vbCrLf,.... When you enter a carriage return directly into excel (using Alt+Enter) the actual code used is just a line feed so you will need to use Cells.Find(What:=vbLf,... Hope this is useful. Alan "Lars Christensen" wrote in message ... Need to replace hard return with <br in excel file. Triede to search and replace for hexadecimal value for hard return (0D 0A) like: Cells.find(What:="&HoD+&H0A", . Won't work. Any ideas or suggestions are appreciated. Regards Lars Christensen. . |
All times are GMT +1. The time now is 01:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com