Skip to content

Instantly share code, notes, and snippets.

@mpecka
Last active April 22, 2024 16:40
Show Gist options
  • Save mpecka/dba4344af56fb34744bc60cbfe0e66ef to your computer and use it in GitHub Desktop.
Save mpecka/dba4344af56fb34744bc60cbfe0e66ef to your computer and use it in GitHub Desktop.
Excel Remove Accents
Function StripAccent(thestring As String)
Dim A As String * 1
Dim B As String * 1
Dim i As Integer
Const AccChars= "áäčďéěíĺľňóôőöŕšťúůűüýřžÁÄČĎÉĚÍĹĽŇÓÔŐÖŔŠŤÚŮŰÜÝŘŽ"
Const RegChars= "aacdeeillnoooorstuuuuyrzAACDEEILLNOOOORSTUUUUYRZ"
For i = 1 To Len(AccChars)
A = Mid(AccChars, i, 1)
B = Mid(RegChars, i, 1)
thestring = Replace(thestring, A, B)
Next
StripAccent = thestring
End Function
@Chromax23
Copy link

Actually what I wrote was wrong. The characters are not in the string, they just look similar. When I try to insert the characters I want replaced, Excel puts a questionmark instead of the character. Does this mean the code page I am using for the macro does not support these characters? I can display them on the Excel sheet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment