tipclaydon
New Member
- Joined
- May 11, 2023
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hi all
ive got a dataset in excel that has names and addresses and i would like to strip any accented letters and replace with normal letters as the data needs saving as a csv file.
i do have this code that allows it but requires the use of formulas which isnt really ideal for this situation. is there a way to do it so the script goes thru the data and just replaces the characters were needed?
ive got a dataset in excel that has names and addresses and i would like to strip any accented letters and replace with normal letters as the data needs saving as a csv file.
i do have this code that allows it but requires the use of formulas which isnt really ideal for this situation. is there a way to do it so the script goes thru the data and just replaces the characters were needed?
VBA Code:
Function StripAccent(thestring As String)
Dim A As String * 1
Dim B As String * 1
Dim i As Integer
Const AccChars= "ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõöùúûüýÿ"
Const RegChars= "SZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyy"
For i = 1 To Len(AccChars)
A = Mid(AccChars, i, 1)
B = Mid(RegChars, i, 1)
thestring = Replace(thestring, A, B)
thestring = worksheetfunction.substitute(thestring,"ß","ss")
Next
StripAccent = thestring
End Function