Results 1 to 16 of 16

Thread: Non-Printing Characters: Box with a Question Mark Unable to remove

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #14
    Another approach is instead of trying to exclude characters you don't want, is to instead only include the character you do want. Phone numbers lend themselves well to this.

    Function CleanContactNumber(ContactNumber, LegalCharacters As String) As String
        Dim Ch As String, CleanNumber As String
        Dim NumStr As String
        Dim I As Long
    
        NumStr = CStr(ContactNumber)
        CleanNumber = ""
        For I = 1 To Len(NumStr)
            Ch = Mid(NumStr, I, 1)
            If InStr(LegalCharacters, Ch) Then
                CleanNumber = CleanNumber & Ch
            End If
        Next I
        CleanContactNumber = CleanNumber
    End Function
    So the cell formula would be

    =CleanContactNumber(C11,"0123456789-")

    Where "0123456789-" are the legal characters.
    Attached Files Attached Files
    Last edited by rlv; 04-16-2017 at 08:06 AM. Reason: typo in function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •