Function to remove non-alphanumeric characters from an Excel spreadsheet
- Sean O'Shea
- Nov 23, 2020
- 1 min read
The below function, posted here, will remove all non-alphanumeric characters from a cell:
Function RemoveNonAlpha(str As String) As String
Dim ch, bytes() As Byte: bytes = str
For Each ch In bytes
If Chr(ch) Like "[A-Z.a-z 0-9]" Then RemoveNonAlpha = RemoveNonAlpha & Chr(ch)
Next ch
End Function
