Line break

Hello everyone. I am facing a recurring problem that often puts my processes in error.

I use Excel files with contact email addresses. However often (due to human error) these lines contain “line breaks”.


I tried several techniques:

  • I read my text
  • I put it in a String variable
  • I do a replace(Environment.Newline,“”) but also a replace(vbNewLine,“”)

but I can’t remove this line break.

Do you have a solution that can allow me to remove these line breaks?


Hi @DimitriLYR

Try this

row(column) = row(column).ToString().Replace(Environment.NewLine, “”)

row(column) = row(column).ToString().Replace(Environment.NewLine, String.Empty)

row(“ColumnName”) = row(“ColumnName”).ToString().Replace(vbCr, “”).Replace(vbLf, “”)

1 Like

Hi @DimitriLYR

Use Trim function
In the Place of Fruits give Columnname

Hope it helps!!

1 Like

Both of your methods work! THANKS

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.