Try adding the Replace and InstrRev functions to find the last new line and. in the text box, then Left in the cell text and save the result "Cleared"
strCellText = itable.Cell(Row, Col).Range.Text 'added Clean = Trim(strcelltext) posFromEnd = InStrRev(Clean, vbCr + chr(7)) 'obviously a newline and a chr(7) .. If (posFromEnd > 0) Then Clean = Trim(Left(Clean, posFromEnd - 1)) End If 'end added uResp = uResp & Clean 'updated
To verify that the last characters in a string do this in the debugger:
strCellText = itable.Cell(Row, Col).Range.Text For r = 1 To Len(strCellText) c = Mid(strCellText, r, 1) Debug.Print Right("0" + Hex(Asc(c)), 2) + " "; Next Debug.Print 'set a breakpoint here
In the next window, copy the result so that we can reason from there
source share