Search for hexadecimal values

  • Thread starter Thread starter Lars Christensen
  • Start date Start date
L

Lars Christensen

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.
 
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
 
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.
 
Back
Top