Unable to remove 'line breaks' in cells containing addresses

MrRAMMounts

New Member
Joined
Oct 29, 2019
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hi

This has flummoxed me. I have attached two images showing how the address details are displayed in the cells, and how they are displayed in the drop down preview section.

As you can see there is the odd square symbol representing a line break in the main cell section and the line break in effect in the preview section. (I exported this data from our old database system that has the addresses listed like this).

No matter what I do, I cannot seem to remove this symbol (en masse), short of going into each cell, going to each line break then pressing backspace, then space.

As I have several hundred lines to go through, I cannot do this manually.

I have found several suggested solutions including Find and Replace using the 'Ctrl+J' function to search for line breaks and replace them with ", ". I have also tried using complicated formulae, but no matter what I try excel keeps returning the error message that it can't find any line breaks (see attached image ). It is not a protected document and isn't set to view only or anything like that.

I have also tried the remove all formatting function and it doesn't make any different, or remove the line breaks, or square symbols.

Does anyone have any suggestions as to why this may be happening?

Regards

Jonathan
 

Attachments

  • AddressSample3.jpg
    AddressSample3.jpg
    171.6 KB · Views: 26
  • AddressSample2.jpg
    AddressSample2.jpg
    22.9 KB · Views: 27
  • AddressSample.jpg
    AddressSample.jpg
    184.7 KB · Views: 27
If you run this macro on the active cell, it should tell you what non-printable character(s) you are dealing with

VBA Code:
Sub CellCharList()
    Dim S As String, Ch As String
    Dim CharStr As String, AscStr As String
    Dim I As Long
    Dim Printables As String
    
    'Build set of printable characters
    For I = 32 To 126
        Printables = Printables & Chr(I) & ","
    Next I
    
    With ActiveCell
        S = .Value
        For I = 1 To Len(S)
            Ch = Mid(S, I, 1)
            If InStr(1, Printables, Ch & ",") > 0 Then
              CharStr = CharStr & Ch
            Else
            CharStr = CharStr & "<" & Right("00" & Application.WorksheetFunction.Dec2Hex(Asc(Ch)), 2) & ">"
            End If
        Next I
    End With
    
    Debug.Print "---"
    Debug.Print S
    Debug.Print CharStr

    MsgBox CharStr
End Sub
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi.

Double clicking on the cell expands the cell to a similar view as the preview box at the top, but when done the little symbols disappear and there is nothing to select. See attached images.
 

Attachments

  • AddressSample6.jpg
    AddressSample6.jpg
    44.1 KB · Views: 7
  • AddressSample5.jpg
    AddressSample5.jpg
    15.6 KB · Views: 6
Upvote 0
If you run this macro on the active cell, it should tell you what non-printable character(s) you are dealing with

VBA Code:
Sub CellCharList()
    Dim S As String, Ch As String
    Dim CharStr As String, AscStr As String
    Dim I As Long
    Dim Printables As String
   
    'Build set of printable characters
    For I = 32 To 126
        Printables = Printables & Chr(I) & ","
    Next I
   
    With ActiveCell
        S = .Value
        For I = 1 To Len(S)
            Ch = Mid(S, I, 1)
            If InStr(1, Printables, Ch & ",") > 0 Then
              CharStr = CharStr & Ch
            Else
            CharStr = CharStr & "<" & Right("00" & Application.WorksheetFunction.Dec2Hex(Asc(Ch)), 2) & ">"
            End If
        Next I
    End With
   
    Debug.Print "---"
    Debug.Print S
    Debug.Print CharStr

    MsgBox CharStr
End Sub
Hi

Thanks for the suggestion, but I am not that advanced in Excel to be able to use VBA code and macros and stuff. Also, it appears that the symbol is the [CHAR 10] one to represent a line break. The issue is that although it is there in the cells in general, when a cell is double clicked (or the preview cell is expanded at the top) the symbol disappears and the line breaks are inserted which can't then be selected.
 
Upvote 0
If you run this macro on the active cell, it should tell you what non-printable character(s) you are dealing with

VBA Code:
Sub CellCharList()
    Dim S As String, Ch As String
    Dim CharStr As String, AscStr As String
    Dim I As Long
    Dim Printables As String
   
    'Build set of printable characters
    For I = 32 To 126
        Printables = Printables & Chr(I) & ","
    Next I
   
    With ActiveCell
        S = .Value
        For I = 1 To Len(S)
            Ch = Mid(S, I, 1)
            If InStr(1, Printables, Ch & ",") > 0 Then
              CharStr = CharStr & Ch
            Else
            CharStr = CharStr & "<" & Right("00" & Application.WorksheetFunction.Dec2Hex(Asc(Ch)), 2) & ">"
            End If
        Next I
    End With
   
    Debug.Print "---"
    Debug.Print S
    Debug.Print CharStr

    MsgBox CharStr
End Sub
I managed to input and run the macro. It returned this result on the target cell (attached). I tried searching for this code (<0B>) in the FIND/REPLACE function, but it didn't find anything.

Is there a way to utilise this code to replace the symbols?

Thanks for the help.
 

Attachments

  • AddressSample7.jpg
    AddressSample7.jpg
    87.9 KB · Views: 6
Upvote 0
I Should also mention that "wrapping text" on any cell in the column with the weird symbols doesn't do anything.
 
Upvote 0
0B (011) is the vertical tab character. Your best way to replace it might be to use VBA.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top