How to identify a hidden carriage return character in a UNIX text file over VBA?
You can test for either ASCII10 or ASCII13:
Sub hskdjfh() v = Range("A1").Value If InStr(1, v, Chr(10)) > 0 Or InStr(1, v, Chr(13)) > 0 Then MsgBox "got a return" Else MsgBox "no return" End IfEnd Sub
EDIT#1:
Here is one way to determine exactly what is in a cell:
Sub WhatsInThere() Dim s As String, L As Long Dim msg As String, i As Long msg = "" s = Range("A1").Text L = Len(s) For i = 1 To L msg = msg & vbCrLf & i & vbTab & Mid(s, i, 1) & vbTab & AscW(Mid(s, i, 1)) Next i MsgBox msgEnd Sub
In this case I placed an Alt+Enter just after the i in cell A1:
Pretty sure there is a bug in VBA, i have 013 010 013 and vba cannot see it, it only sees it as 013 010,
removing 013 010 from the string using replace , then checking the result there is THEN another 013 , so it is taking 2 lines of code to remove it due to this bug