Hi, I have written a code that should loop thru a column and if there is a cell with carriage return, it should split the text so the last row of text in the cell is moved to the next column, and the remaining text should be in one row.
Example:
The cell in row 1 should be like row 2.
The code I have written is:
This code will move all text in the cell to the next column, so it is not very useful.
Any thoughts on what I am missing here?
Example:
The cell in row 1 should be like row 2.
Car make Volvo | |||
Car make | Volvo |
The code I have written is:
VBA Code:
Sub SplitText()
Dim cell As Range
Dim str() As String
For Each cell In Range("G1:G215")
str = VBA.Split(ActiveCell.Value, vbCrLf)
ActiveCell.Resize(1, UBound(str) + 1).Offset(0, 1) = str
Next cell
End Sub
This code will move all text in the cell to the next column, so it is not very useful.
Any thoughts on what I am missing here?