Replace special character in whole column

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Replace special character in whole column

Post by YasserKhalil »

Hello everyone

I am trying the code

Code: Select all

Sub Test()
    Application.Calculation = xlManual
        Columns(2).Replace What:="ـ", Replacement:=""
    Application.Calculation = xlAutomatic
End Sub
This doesn't work for whole column although when looping through each cell and using Replace it works with each cell
Is there a way to make that works on the whole column.. I tried putting the character ~ before the character but doesn't work too

I even tried usign Chr(220) but doesn't work too

Code: Select all

Columns(2).Replace What:=Chr(220), Replacement:=""
I also tried using ChrW but doesn't work too

Code: Select all

Columns(2).Replace What:=ChrW(1600), Replacement:="", LookAt:=xlPart
Posted at this link too
https://www.excelforum.com/excel-progra ... olumn.html" onclick="window.open(this.href);return false;
https://chandoo.org/forum/threads/repla ... umn.43145/" onclick="window.open(this.href);return false;
Last edited by YasserKhalil on 30 Nov 2019, 15:23, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Replace special character in whole column

Post by HansV »

The character in your code is ChrW(1600), not Chr(220)...
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Re: Replace special character in whole column

Post by YasserKhalil »

Thanks a lot Mr. Hans
But I already tried that too using ChrW(1600) and doesn't work

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Replace special character in whole column

Post by HansV »

I can confirm that it doesn't work. Is this some kind of special character in Arabic?
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Re: Replace special character in whole column

Post by YasserKhalil »

Yes you are right. It is special character in Arabic .. Is this can be an obstacle?

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Replace special character in whole column

Post by HansV »

Probably, but I don't know Arabic, as you know. You might have better luck on an Arabic-language forum.
Best wishes,
Hans

YasserKhalil
PlatinumLounger
Posts: 4913
Joined: 31 Aug 2016, 09:02

Re: Replace special character in whole column

Post by YasserKhalil »

I already could solve it using replace but cell by cell. And I am wondering why doesn't work for the whole column ..!! Although the other Arabic characters work well
You have helped me before that to get rid of this character using UDF