How do I remove all special characters which don\'t fall under ASCII category in VBA?
These are some of the symbols which appear in my string.
<
Supposing you have:
Then the following code will get the String from A1 and let through only ANSI (code 0 to 255) in A2.
Sub test()
Dim s1 As String, s2 As String, c As String, i As Long, iAsc As Integer
s1 = Range("A1").Value
s2 = ""
For i = 1 To Len(s1)
c = Mid(s1, i, 1)
iAsc = AscW(c)
If iAsc <= 255 Then
s2 = s2 & c
End If
Next
Range("A2").Value = s2
End Sub