I have this code and I still can't seem to replace non English characters like Vietnamese or Thai from my data with a simple "placeholder".
Sub NonLatin()
Dim cell As Range
For Each cell In Range("A1", Cells(Rows.Count, "A").End(xlUp))
s = cell.Value
For i = 1 To Len(s)
If Mid(s, i, 1) Like "[!A-Za-z0-9@#$%^&* * ]" Then cell.Value = "placeholder"
Next
Next
End Sub
Appreciate your help
You can replace any chars that are out of e. g. ASCII range (first 128 chars) with placeholder using the below code:
Option Explicit
Sub Test()
Dim oCell As Range
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "[^u0000-u00F7]"
For Each oCell In [A1:C4]
oCell.Value = .Replace(oCell.Value, "*")
Next
End With
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With