I need to insert lines in a cell, but I am unable to insert line breaks.
For example :
line1
line2
line3
With VBA code :
Ws.Cells(i, 2) = line1 & line2 & line3
I get :
line1 line2 line3
How can I resolve this issue?
Is this what you are trying?
Ws.Cells(i, 2).Value = "line1" & vbnewline & "line2" & vbnewline & "line3"
or
Ws.Cells(i, 2).Value = "line1" & vbCrLf & "line2" & vbCrLf & "line3"
EDIT: Inserted quotes as mentioned in my comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With