Share via

find and replace all special characters (after an encoding problem)

Anonymous
2013-02-16T18:26:12+00:00

Hello,

I created a huge Excel file with text.

Unfortunately when the data was retrieved, there was an encoding problem.

Some special characters like "é" were replaced by "é".

I would like to find all "é" and replace them by "é"

with CTRL+F it worked well in Office 2010 but it does not work any more.

How can I do?

Regards,

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2013-02-16T22:34:28+00:00

    Hello,

    Many thanks but it does not work.

    However, your answer is a path to the solution.

    I found this code but it does not work either.

    I will study macros.

    Regards.

    Sub utf8() ' ' utf8 Makro ' Convert UTF-8 characters to Excel format ' ' key combination: Strg+w '

    ' a acute big
        Cells.Replace What:="Á", Replacement:="Á", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a acute small
        Cells.Replace What:="á", Replacement:="á", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a brevis small
        Cells.Replace What:="ă", Replacement:=ChrW(259), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a cedilla big
        Cells.Replace What:="Ä„", Replacement:=ChrW(260), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a cedilla small
        Cells.Replace What:="Ä…", Replacement:=ChrW(261), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a circumflex big
        Cells.Replace What:="Â", Replacement:="Â", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a circumflex small
        Cells.Replace What:="â", Replacement:="â", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a grave small
        Cells.Replace What:="à", Replacement:="à", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a macron big
        Cells.Replace What:="Ä€", Replacement:=ChrW(256), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a macron small
        Cells.Replace What:="ā", Replacement:=ChrW(257), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a ring big
        Cells.Replace What:="Ã…", Replacement:="Å", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a ring small
        Cells.Replace What:="Ã¥", Replacement:="å", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a tilde small
        Cells.Replace What:="ã", Replacement:="ã", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a umlaut big
        Cells.Replace What:="Ä", Replacement:="Ä", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' a umlaut small
        Cells.Replace What:="ä", Replacement:="ä", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' ae ligature small
        Cells.Replace What:="æ", Replacement:="æ", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' ae ligature big
        Cells.Replace What:="Æ", Replacement:="Æ", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' c acute big
        Cells.Replace What:="Ć", Replacement:=ChrW(262), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' c acute small
        Cells.Replace What:="ć", Replacement:=ChrW(263), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' c caron big
        Cells.Replace What:="Č", Replacement:=ChrW(268), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' c caron small
        Cells.Replace What:="č", Replacement:=ChrW(269), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' c cedilla big
        Cells.Replace What:="Ç", Replacement:="Ç", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' c cedilla small
        Cells.Replace What:="ç", Replacement:="ç", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' d dash big
        Cells.Replace What:="Đ", Replacement:=ChrW(272), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' d dash small
        Cells.Replace What:="Ä‘", Replacement:=ChrW(273), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' dh small small
        Cells.Replace What:="ð", Replacement:="ð", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e acute big
        Cells.Replace What:="É", Replacement:="É", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e acute small
        Cells.Replace What:="é", Replacement:="é", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e caron small
        Cells.Replace What:="Ä›", Replacement:=ChrW(283), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e cedilla small
        Cells.Replace What:="Ä™", Replacement:=ChrW(281), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e circumflex small
        Cells.Replace What:="ê", Replacement:="ê", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e grave big
        Cells.Replace What:="È", Replacement:="È", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e grave small
        Cells.Replace What:="è", Replacement:="è", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e macron big
        Cells.Replace What:="Ä’", Replacement:=ChrW(274), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e macron small
        Cells.Replace What:="Ä“", Replacement:=ChrW(275), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e point small
        Cells.Replace What:="Ä—", Replacement:=ChrW(279), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e turned big
        Cells.Replace What:="Ə", Replacement:=ChrW(399), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e turned small
        Cells.Replace What:="É™", Replacement:=ChrW(601), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
        Cells.Replace What:="ǝ", Replacement:=ChrW(601), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' e umlaut small
        Cells.Replace What:="ë", Replacement:="ë", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' g brevis small
        Cells.Replace What:="ÄŸ", Replacement:=ChrW(287), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' g point big
        Cells.Replace What:="Ä ", Replacement:=ChrW(288), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' g point small
        Cells.Replace What:="Ä¡", Replacement:=ChrW(289), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' h macron big
        Cells.Replace What:="Ħ", Replacement:=ChrW(294), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' h macron small
        Cells.Replace What:="ħ", Replacement:=ChrW(295), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i acute big
        Cells.Replace What:="Í", Replacement:="Í", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i acute small
        Cells.Replace What:="Ã", Replacement:="í", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i brevis small
        Cells.Replace What:="Ä", Replacement:=ChrW(301), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i circumflex big
        Cells.Replace What:="ÃŽ", Replacement:="Î", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i circumflex small
        Cells.Replace What:="î", Replacement:="î", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i grave small
        Cells.Replace What:="ì", Replacement:="ì", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i macron big
        Cells.Replace What:="Ī", Replacement:=ChrW(298), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i macron small
        Cells.Replace What:="Ä«", Replacement:=ChrW(299), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i pointed big
        Cells.Replace What:="İ", Replacement:=ChrW(304), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i pointless small
        Cells.Replace What:="ı", Replacement:=ChrW(305), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' i umlaut small
        Cells.Replace What:="ï", Replacement:="ï", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' k cedilla big
        Cells.Replace What:="Ķ", Replacement:=ChrW(310), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' k cedilla small
        Cells.Replace What:="Ä·", Replacement:=ChrW(311), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' l cedilla small
        Cells.Replace What:="ļ", Replacement:=ChrW(316), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' l slash big
        Cells.Replace What:="Ł", Replacement:=ChrW(321), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' l slash small
        Cells.Replace What:="Å‚", Replacement:=ChrW(322), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' n acute small
        Cells.Replace What:="Å„", Replacement:=ChrW(324), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' n caron small
        Cells.Replace What:="ň", Replacement:=ChrW(328), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' n cedilla small
        Cells.Replace What:="ņ", Replacement:=ChrW(326), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' n tilde big
        Cells.Replace What:="Ñ", Replacement:="Ñ", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' n tilde small
        Cells.Replace What:="ñ", Replacement:="ñ", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o acute big
        Cells.Replace What:="Ó", Replacement:="Ó", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o acute small
        Cells.Replace What:="ó", Replacement:="ó", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o brevis big
        Cells.Replace What:="ÅŽ", Replacement:=ChrW(334), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o brevis small
        Cells.Replace What:="ŏ", Replacement:=ChrW(335), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o circumflex small
        Cells.Replace What:="ô", Replacement:="ô", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o double acute big
        Cells.Replace What:="Ö", Replacement:=ChrW(336), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o double acute small
        Cells.Replace What:="Å‘", Replacement:=ChrW(337), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o grave small
        Cells.Replace What:="ò", Replacement:="ò", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o macron big
        Cells.Replace What:="Ō", Replacement:=ChrW(332), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o macron small
        Cells.Replace What:="ō", Replacement:=ChrW(333), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o slash big
        Cells.Replace What:="Ø", Replacement:="Ø", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o slash small
        Cells.Replace What:="ø", Replacement:="ø", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o tilde small
        Cells.Replace What:="õ", Replacement:="õ", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' o umlaut small
        Cells.Replace What:="ö", Replacement:="ö", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' r caron big
        Cells.Replace What:="Ř", Replacement:=ChrW(344), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' r caron small
        Cells.Replace What:="Å™", Replacement:=ChrW(345), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' r cedilla small
        Cells.Replace What:="Å—", Replacement:=ChrW(343), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' s acute big
        Cells.Replace What:="Åš", Replacement:=ChrW(346), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' s acute small
        Cells.Replace What:="Å›", Replacement:=ChrW(347), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' s caron big
        Cells.Replace What:="Å ", Replacement:=ChrW(352), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' s caron small
        Cells.Replace What:="Å¡", Replacement:=ChrW(353), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' s cedilla big
        Cells.Replace What:="Åž", Replacement:=ChrW(350), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' s cedilla small
        Cells.Replace What:="ÅŸ", Replacement:=ChrW(351), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' sz ligature small
        Cells.Replace What:="ß", Replacement:="ß", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' t cedilla big
        Cells.Replace What:="Å¢", Replacement:=ChrW(354), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' t cedilla small
        Cells.Replace What:="Å£", Replacement:=ChrW(355), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' thorn big
        Cells.Replace What:="Þ", Replacement:="Þ", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u acute big
        Cells.Replace What:="Ú", Replacement:="Ú", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u acute small
        Cells.Replace What:="ú", Replacement:="ú", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u brevis big
        Cells.Replace What:="Ŭ", Replacement:=ChrW(364), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u brevis small
        Cells.Replace What:="Å", Replacement:=ChrW(365), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u cedilla small
        Cells.Replace What:="ų", Replacement:=ChrW(371), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u circumflex small
        Cells.Replace What:="û", Replacement:="û", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u double acute small
        Cells.Replace What:="ű", Replacement:=ChrW(369), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u grave small
        Cells.Replace What:="ù", Replacement:="ù", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u macron big
        Cells.Replace What:="Ū", Replacement:=ChrW(362), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u macron small
        Cells.Replace What:="Å«", Replacement:=ChrW(363), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u ring small
        Cells.Replace What:="ů", Replacement:=ChrW(367), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u umlaut big
        Cells.Replace What:="Ü", Replacement:="Ü", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' u umlaut small
        Cells.Replace What:="ü", Replacement:="ü", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' y acute small
        Cells.Replace What:="ý", Replacement:="ý", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' z acute small
        Cells.Replace What:="ź", Replacement:=ChrW(378), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' z caron big
        Cells.Replace What:="Ž", Replacement:=ChrW(381), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' z caron small
        Cells.Replace What:="ž", Replacement:=ChrW(382), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' z point big
        Cells.Replace What:="Å»", Replacement:=ChrW(379), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' z point small
        Cells.Replace What:="ż", Replacement:=ChrW(380), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' cedilla
        Cells.Replace What:="̨", Replacement:=ChrW(808), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' diaresis
        Cells.Replace What:="̈", Replacement:=ChrW(776), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' halfcircle, right open
        Cells.Replace What:="´", Replacement:=ChrW(703), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' macron
        Cells.Replace What:="Ì„", Replacement:=ChrW(772), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' macron below
        Cells.Replace What:="̱", Replacement:=ChrW(817), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    ' apostroph
        Cells.Replace What:="ʼ", Replacement:=ChrW(700), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=True
    
    End Sub
    
    5 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2016-06-01T14:06:55+00:00

    Hi,

    Try this:

    Sub ReplaceSpecialCharacters()

    Dim d

    Set d = CreateObject("Scripting.Dictionary")

        d.Add "è", "è"

        d.Add "È", "è"

        d.Add "ù", "ù"

        d.Add "Ã ", "à"

        d.Add "á", "á"

        d.Add "ò", "ò"

        d.Add "Ã-", "Ö"

        d.Add "Ö", "Ö"

        d.Add "Ä", "Ä"

        For Each Key In d

            Selection.Replace What:=Key, Replacement:=d(Key), LookAt:=xlPart, SearchOrder _

                :=xlByRows, MatchCase:=True, SearchFormat:=False, ReplaceFormat:=False

        Next Key

    Set d = Nothing

    End Sub

    2 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2013-02-16T21:13:29+00:00

    Hi,

    try this...

    step1

    Save As, your Workbook with extension .xlsm (macros enabled)

    step2

    1. press ALT+F11 to open Visual Basic
    2. Insert > module and paste the code below on the right

    Sub ReplaceSymbols()Selection.Replace What:=ChrW(&HC3) & ChrW(&HA9), Replacement:=ChrW(&HE9), LookAt:=xlPartEnd Sub

    1. Press ALT+Q to Close Visual Basic

    step3

    To run the macro, press ALT+F8, 

    select <ReplaceSymbols> from the list and click the run button.

    Note

    select the range and run the code.

    2 people found this answer helpful.
    0 comments No comments
  4. Ashish Mathur 101.8K Reputation points Volunteer Moderator
    2013-02-16T23:28:52+00:00

    Hi,

    I could find for é and replace with é.  I am using Excel 2013.   Ensure that Find and Replace > Options, Match Entire cell contents is unchecked.

    Hope this helps.

    1 person found this answer helpful.
    0 comments No comments
  5. Anonymous
    2013-02-17T00:07:37+00:00

    It was weird.

    It did not worked.

    But when I am in XLSM (with macros activated), it works.

    0 comments No comments