+ Reply to Thread
Results 1 to 5 of 5

Macro for search and replace dash - unicode character not recognised

  1. #1
    Registered User
    Join Date
    03-15-2016
    Location
    Stockholm
    MS-Off Ver
    2007
    Posts
    2

    Macro for search and replace dash - unicode character not recognised

    Hi, I’m a bit new to VBA coding but I’m having trouble with a macro I've recorded. I’m trying to create a macro that search for a certain character (−) that seems to have a unicode character "2212" (Im inserting the sign in Word and by using Alt + X it returns the value "2212"). I want to replace it with an minus sign / dash so excel wont treat the data as text (if i do the same in Word it returns the value "002D").

    Please Login or Register  to view this content.
    I don’t know it its correct to ad a "&H" but that’s the only way I’ve found to make the VB editor accept my formula. It also removes the two zeros for some reason. Anyone that knows what I’m doing wrong? I’m very thankful for all help that you can give!

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro for search and replace dash - unicode character not recognised

    Deleted......
    Last edited by jindon; 03-15-2016 at 04:55 AM.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro for search and replace dash - unicode character not recognised

    Try change What:= to ChrW(8722) and Replacement:= to "-" and see if it works...

  4. #4
    Registered User
    Join Date
    03-15-2016
    Location
    Stockholm
    MS-Off Ver
    2007
    Posts
    2

    Re: Macro for search and replace dash - unicode character not recognised

    Thx jindon for your reply, it sort of works! For some reason I tried your soloution without the "ActiveWorkbook.RefreshAll" that reloads data that is linked to a webpage, and then it replace all incrorrect characters that i want. But with the refresh in the macro, it doesn't work? It seems like its done in the wrong order or something?

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Macro for search and replace dash - unicode character not recognised

    If I'm right, you will need to replace each time after your refresh macro...

    Anyway you can get character code by AscW function...

+ 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. [SOLVED] Dates recognised when recording Macro, but not recognised when running it.
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2015, 10:19 AM
  2. Search from a cel & replace with new character
    By satish439 in forum Excel General
    Replies: 4
    Last Post: 05-14-2014, 06:45 AM
  3. Search and replace character with cell value
    By rfcapinto in forum Excel General
    Replies: 2
    Last Post: 03-24-2014, 05:31 PM
  4. Search and Replace a specific character
    By VegasL in forum Excel General
    Replies: 6
    Last Post: 12-09-2012, 01:26 PM
  5. Search and replace text in cell with single character
    By piputty in forum Excel General
    Replies: 1
    Last Post: 08-05-2011, 10:32 PM
  6. Unicode and Search and Replace
    By Rebecca in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-30-2005, 02:05 AM
  7. [SOLVED] Search and replace character with <alt+enter> in excell cell
    By JRR in forum Excel General
    Replies: 1
    Last Post: 07-22-2005, 04:05 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