Home > Forum Home > Presenting and Reporting Data > ADP Report > Split Line Feeds to Cells Share

Split Line Feeds to Cells

Excel Help for Split Line Feeds To Cells in Presenting and Reporting Data


Forum TopicLogin

Split Line Feeds To Cells

Rate this:
(3/5 from 1 vote)
AngryThis is caused by line feeds within the source data that are imported as text. To avoid this, try to use alternative import options or if using a paste function then Paste Special > Unicode Text. If this is not possible then a VBA macro can split the lines feeds into separate cells. The following VBA sub routine will split values for a selected range of cells in a column to continuous rows in the adjacent column to the right.

VBA Code:
Sub LinesToCells()
    Dim cr, ac As Variant
    Dim r, c, i As Integer
    r = ActiveCell.Row
    c = ActiveCell.Column + 1
    For Each cr In Selection
        ac = Split(cr.Text, Chr(10))
        For i = LBound(ac) To UBound(ac)
            Cells(r, c).Value = ac(i)
            r = r + 1
        Next
    Next
End Sub
 Excel Business Forums Administrator
 Posted by on
 
View Full Post

Find relevant Excel templates and add-ins for Split Line Feeds to Cells in the