Thread: [Solved] Sort Filter Problem
View Single Post
 
Old 01-26-2022, 06:34 PM
NoSparks NoSparks is offline Windows 10 Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

In Tanzania the T is the 3rd character in, the first 2 are unprintable characters so you can't see them.
I ran this code against one of the cells containing TANZANIA to see what was actually in the cell
Code:
Sub CheckOfCharacters()
    Dim i As Integer, str As String
str = ActiveCell.Value
'MsgBox ActiveCell.Font.Name
    For i = 1 To Len(str)
       Debug.Print Mid(str, i, 1) & "  =  " & Asc(Mid(str, i, 1))
       Debug.Print Mid(str, i, 1) & "  =  " & AscW(Mid(str, i, 1))
    Next
End Sub
Running this code fixes it up
Code:
Sub Clean_C_Column()

    Dim lastRow As Long
    Dim rng As Range
    Dim cel As Range
    
With Sheets("Sheet1")
    lastRow = .Range("C" & .Rows.Count).End(xlUp).Row
    Set rng = .Range("C2:C" & lastRow)
    For Each cel In rng
        cel.Value = Replace(cel.Value, ChrW(8203), "")
    Next cel
End With

End Sub
Reply With Quote