Forum Discussion

Rmcclung's avatar
Rmcclung
Copper Contributor
May 22, 2023
Solved

Excel does not recognize line breaks until I double click

Hi Everyone,   I have a basic .xlsm file where a list of addresses is imported from the web. By default, the data is displayed in each cell bunched up with no breaks between the addresses. When you...
  • HansVogelaar's avatar
    May 22, 2023

    Rmcclung 

    The problem is that the addresses are separated by carriage returns (character code 13), but Excel uses line feed (character code 10) as line break. Here is a macro you can run. Select the data before you do so.

    Sub SplitData()
        Application.ScreenUpdating = False
        Selection.Replace What:=vbCr, Replacement:="|", LookAt:=xlPart
        Selection.TextToColumns DataType:=xlDelimited, ConsecutiveDelimiter:=True, _
        Tab:=False, SemiColon:=False, Comma:=False, Space:=False, _
        Other:=True, OtherChar:="|"
        Application.ScreenUpdating = True
    End Sub

Resources