Forum Discussion

Mcquim's avatar
Mcquim
Copper Contributor
Oct 27, 2021
Solved

Delimiter for Separate Line Breaks in Cell not Working

I am trying to split a cell with three line breaks into 4 columns. When using the text to columns wizard and selecting delimited, all the text in the cell shows up in the preview. When I hit next, only the first line shows up. Nothing after the first line break appears. 

  • mrt1012's avatar
    mrt1012
    Nov 01, 2021

    HansVogelaar So I found a way to get it to work. All I did was edit the information that appears in the formula bar- like delete a word and then retype it-and somehow the text to column options works just fine.

9 Replies

    • Mcquim's avatar
      Mcquim
      Copper Contributor
      I have not figured out how to get this to work using the text to columns wizard but I did find a macro that works:
      Sub Delimit()
      'splits Text active cell using ALT+10 char as separator
      Dim splitVals As Variant
      Dim totalVals As Long
      Dim i As Integer

      For i = 1 To 1000
      splitVals = Split(ActiveCell.Value, Chr(10))
      totalVals = UBound(splitVals)
      Range(Cells(ActiveCell.Row, ActiveCell.Column + 1), Cells(ActiveCell.Row, ActiveCell.Column + 1 + totalVals)).Value = splitVals
      ActiveCell.Offset(1, 0).Activate
      Next i

      End Sub
      • Mcquim 

        Here is a shorter macro. Select the cells with multiple lines (in a column) before running the macro.

        Sub SplitLines()
            Selection.TextToColumns DataType:=xlDelimited, Other:=True, OtherChar:=vbLf
        End Sub
  • mrt1012's avatar
    mrt1012
    Copper Contributor
    This is happening to me as well. It’ll work randomly.
  • Mcquim 

    In Step 2 of the wizard, tick the Other check box, then click in the box next to it and press Ctrl+J. This is the code for a line break.

    • Mcquim's avatar
      Mcquim
      Copper Contributor

      HansVogelaar 

       

      I have done this however, the wizard is not recognizing any of my text after the first line break. So when I try to do ctrl+j, nothing happens. 

       

      • Mcquim 

        Strange...

        Instead of Ctrl+J, you can also try clicking in the box next to Other and pressing Alt+010 using the numeric keypad.

Resources