+ Reply to Thread
Results 1 to 6 of 6

Replacing regular and special characters

  1. #1
    Forum Contributor
    Join Date
    03-18-2010
    Location
    FL
    MS-Off Ver
    Excel 2016
    Posts
    147

    Replacing regular and special characters

    Hi there,

    I need a macro or any other way to replace regular and special characters in excel. I have this macro but only the last line is working. Any ideas? Thanks!


    Sub Special_Characters()
    '
    ' Special_Characters Macro
    Range("A1:ZZ200000").Replace What:="á", Replacement:="a", LookAt:=xlWhole
    Range("A1:ZZ200000").Replace What:="¯", Replacement:="a", LookAt:=xlWhole
    Range("A1:ZZ200000").Replace What:="¦", Replacement:="i", LookAt:=xlWhole
    Range("A1:ZZ200000").Replace What:="ñ", Replacement:="n", LookAt:=xlWhole
    Range("A1:ZZ200000").Replace What:="ó", Replacement:="o", LookAt:=xlWhole
    Range("A1:ZZ200000").Replace What:="Ñ", Replacement:="N", LookAt:=xlWhole
    Range("A1:ZZ200000").Replace What:="í", Replacement:="i", LookAt:=xlWhole
    Range("i1:i500").Replace What:="pr", Replacement:="US", LookAt:=xlWhole


    End Sub

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,162

    Re: Replacing regular and special characters

    Please see yellow banner above regarding sample file upload showing before | after expectation...
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,340

    Re: Replacing regular and special characters

    á 135 =CODE(A1)
    a 97

    Range("A1:ZZ200000").Replace What:="á", Replacement:="a", LookAt:=xlWhole 135 =CODE(MID(A4,37,1)) 97 =CODE(MID(A4,55,1))
    Range("A1:ZZ200000").Replace What:="¯", Replacement:="a", LookAt:=xlWhole 248 .. .. .. .. .. .. .. .. .. .. .. .. 97 .. .. .. .. .. .. .. .. .. .. .. ..
    Range("A1:ZZ200000").Replace What:="¦", Replacement:="i", LookAt:=xlWhole 95 .. .. .. .. .. .. .. .. .. .. .. .. 105 .. .. .. .. .. .. .. .. .. .. .. ..
    Range("A1:ZZ200000").Replace What:="ñ", Replacement:="n", LookAt:=xlWhole 150 .. .. .. .. .. .. .. .. .. .. .. .. 110 .. .. .. .. .. .. .. .. .. .. .. ..
    Range("A1:ZZ200000").Replace What:="ó", Replacement:="o", LookAt:=xlWhole 151 .. .. .. .. .. .. .. .. .. .. .. .. 111 .. .. .. .. .. .. .. .. .. .. .. ..
    Range("A1:ZZ200000").Replace What:="Ñ", Replacement:="N", LookAt:=xlWhole 132 .. .. .. .. .. .. .. .. .. .. .. .. 78 .. .. .. .. .. .. .. .. .. .. .. ..
    Range("A1:ZZ200000").Replace What:="í", Replacement:="i", LookAt:=xlWhole 146 .. .. .. .. .. .. .. .. .. .. .. .. 105 .. .. .. .. .. .. .. .. .. .. .. ..

    Range("A1:ZZ200000").Replace What:=Chr(135), Replacement:="a", LookAt:=xlWhole
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    03-18-2010
    Location
    FL
    MS-Off Ver
    Excel 2016
    Posts
    147

    Re: Replacing regular and special characters

    Thank you but sorry, can you help in explain your reply?

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,162

    Re: Replacing regular and special characters

    can you help in explain your reply?
    My reply says...Add a sample file...

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,340

    Re: Replacing regular and special characters

    What's to explain?

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Instead of:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The other examples show the codes to use.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replacing Special Characters
    By sathishkm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-18-2019, 12:19 PM
  2. [SOLVED] Regular expression with Cyrillic characters
    By Vixx1 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-10-2019, 05:47 AM
  3. [SOLVED] Replace accented characters in worksheet name to regular characters
    By kingsdime29x in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2017, 10:59 AM
  4. Find & Replace all special characters with regular
    By mike_vr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2017, 04:23 AM
  5. [SOLVED] Macro to replace special characters, keep list of replacements or confirm before replacing
    By mattyfaz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-14-2015, 09:31 PM
  6. [SOLVED] Regex Replacing Formulas: Issue with Special Characters
    By k64 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2014, 10:17 AM
  7. Replacing Special Characters when importing text
    By Bytor47 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-23-2009, 02:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1