0

The cell's content has a line break in between two lines. Usually if I use

If rngCellContent = "Line1" & Chr(10) & "Line2" then varReturn = True

it returns True but I have one case where it returns False. I pasted the "faulty content" into Notepad++ but I can see no difference. It also shows me the same line break (CRLF). Might there be a difference which gets "removed" through using the clip board?

How do I find out what kind of line breaks or non-print characters the cell contains that causes the return value to be false?

Note: I didn't compare the binary values of the strings yet. Can I just use a converter and paste it into there? Or will I run into the same problem?

Albin
  • 1,000
  • 1
  • 11
  • 33
  • `Chr(10)` is only a linefeed, not a carriagereturn and linefeed. By the way, you can use the constants `vbCr`, `vbLf`, `vbCrLf`, and `vbNewLine` rather than `Chr` – Rory Aug 12 '20 at 10:39
  • @Rory yeah you are absolutely right, then something is fishy must be going on using the clip board. Is there a way I can determine which non-print characters/line-breaks the cell content has (without trail and error, since the suggested line breaks did not do the trick)? – Albin Aug 12 '20 at 10:42
  • 1
    Loop through the characters and check the `AscW` value of each one. – Rory Aug 12 '20 at 10:52

0 Answers0