+ Reply to Thread
Results 1 to 17 of 17

Cannot find and delete a specific character

  1. #1
    Registered User
    Join Date
    08-12-2013
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    58

    Cannot find and delete a specific character

    Hello,
    I am using a macro to remove certain characters from text stored in an Excel sheet. I discovered that there is a specific character, U+0640 Unicode (the Arabic Tatweel) that cannot be deleted.
    Moreover, if I try to find the character using Excel's Find and replace something strange happens: if the sheet contains this character Excel "finds" it in all cells except those that actually contain it (if the sheet doesn't contain the character Excel reports no results).
    Any idea what's going on?

    Chen

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Cannot find and delete a specific character

    No idea, have you copied the text to Notepad or another editor? Try it in Word and see what the character really looks like.
    You can also have Excel display the actual ascii code
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    08-12-2013
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Cannot find and delete a specific character

    I can see the character (it looks like an underscore) and Excel return its correct Unicode value. Still, finding and replacing doesn't work on it.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Cannot find and delete a specific character

    Have you tried character by character?

  5. #5
    Registered User
    Join Date
    08-12-2013
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Cannot find and delete a specific character

    what do you mean?

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Cannot find and delete a specific character

    VBA macro, take it character by character
    Using the mid(textstring,x,1)

  7. #7
    Registered User
    Join Date
    08-12-2013
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Cannot find and delete a specific character

    Thanks for the suggestion. However, even if it works in principle, I am working on a large amount of data and I cannot afford to go cell-by-cell character-by-character. I am using the Range.Replace method, which works fine with almost all characters.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,703

    Re: Cannot find and delete a specific character

    Copy a sentence which has this special character in it into cell A1 and run this.
    Does that tell you anything?
    Please Login or Register  to view this content.

    Re: and I cannot afford to go cell-by-cell character-by-character
    Maybe you have to live with your problem

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Cannot find and delete a specific character

    Try this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Cannot find and delete a specific character

    This worked for me:

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Cannot find and delete a specific character

    Do you have a sample file to attach?

  12. #12
    Registered User
    Join Date
    08-12-2013
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Cannot find and delete a specific character

    See a sample file. It contains a list of unicode characters which I would like to delete and their respective values.
    The file also contains a code to delete these characters. Notice that only some of them are deleted by the code. Any idea why?
    Attached Files Attached Files

  13. #13
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Cannot find and delete a specific character

    Strange indeed, looks like extended ascii charterset.
    I added three columsn with the three wingdings font and then you see the corresponding symbols but the search and replace will probably not work.
    I do not have a solution for you, will keep looking and see if I find something
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    08-12-2013
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Cannot find and delete a specific character

    You are right, changing the font type doesn't affect the results.
    But at least I got one person to admit that there IS something strange going on here
    Thanks for trying!

  15. #15
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Cannot find and delete a specific character

    The reason can also be that maybe, like my system, you do not have the special characters instaalled, I ran into this some time ago whne I helped someone using Turkish fonts, the characters were not recognized until I implemented these.
    I'm not at my own system now but you could take a look at international settings in your Windows and especially something about extended or special characters fonts

  16. #16
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Cannot find and delete a specific character

    Hi,

    Have you tried using an array
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  17. #17
    Registered User
    Join Date
    08-12-2013
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Cannot find and delete a specific character

    I just did, and it worked!
    It is many times slower than Range.Replace but I guess I can combine the methods.
    Many thanks!

+ 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. Code to delete text left of a specific character
    By Yoshi64 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-21-2014, 05:38 AM
  2. [SOLVED] Find Specific character
    By janagan in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-07-2014, 04:27 PM
  3. Find and delete single character
    By qlpapp in forum Excel General
    Replies: 4
    Last Post: 01-23-2014, 06:03 PM
  4. Find and delete single character
    By KH_GS in forum Excel General
    Replies: 13
    Last Post: 01-23-2014, 04:26 AM
  5. [SOLVED] Delete row macro based on a specific character in the FIRST postion of a specified column
    By slawless in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-21-2012, 07:38 AM
  6. Macro to find character and delete all text in cell after the character
    By SpencerRichman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2012, 06:08 PM
  7. Macro to delete a specific character and capitalizing a column
    By abuchan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2011, 11:54 PM

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