replace accented characters with regular characters in Excel

baskar5353

Board Regular
Joined
Mar 21, 2015
Messages
114
hi,

i'm having record with Spanish word in excel i want to replace into regular character.

whole sheets i want to replace into regular characters where the accent character is there

how to do in VBA
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
hi,

i'm having record with Spanish word in excel i want to replace into regular character.

whole sheets i want to replace into regular characters where the accent character is there

how to do in VBA
Do you have a list of the accented characters you want to be replaced and what you want them replaced with?
 
Upvote 0
"á" change as "a" like wise from "a to z" i want to change them as regular character.
I'm afraid I don't know of any clever or quick ways to do this (I'm sure someone here will though). The only way I can think of doing it is very long an convoluted involving specific lines of VBA for each accented character to be replaced. If you look at my example below it will replace any á with a, any é with e and any ó with o. You can copy the format of my code for each other type of accented character but I appreciate this is probably not the most efficient way of doing it. I have made the different sections of the code different colours so you can easily see how small each section to be replicated is. Simply change the Replace What and the Replacement ​to suit your needs.

Rich (BB code):
Sub Replace_Accents()
Dim ws As Worksheet
For Each ws In Worksheets
    With ws
        .Cells.Replace What:="á", Replacement:="a", LookAt:= _
        xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    End With
Next ws
For Each ws In Worksheets
    With ws
        .Cells.Replace What:="é", Replacement:="e", LookAt:= _
        xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    End With
Next ws
For Each ws In Worksheets
    With ws
        .Cells.Replace What:="ó", Replacement:="o", LookAt:= _
        xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    End With
Next ws

End Sub
 
Upvote 0
Hi, another possible option (probably haven't covered all of the different chars, but you can add as required).

Code:
Sub m()
Const sFm As String = "ÀÁÂÃÄÅàáâãäåÈÉÊËèéêëÌÍÎÏìíîïÑñÒÓÔÕÖòóôõöÙÚÛÜùúûüÝýÿ" 'add more as required
Const sTo As String = "AAAAAAaaaaaaEEEEeeeeIIIIiiiiNnOOOOOoooooUUUUuuuuYyy" 'add more as required
Dim i As Long, ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    For i = 1 To Len(sFm)
        ws.Cells.Replace Mid(sFm, i, 1), Mid(sTo, i, 1), LookAt:=xlPart, MatchCase:=True
    Next i
Next ws
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,186
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top