MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Problems replacing "." with ","

Posted by Ørjan Tjemsland on September 22, 2000 6:19 AM

I have made a macro that replaces "." with "," in numbers. The code I use is:

Selection.Replace What:=".", Replacement:=",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=True

It works fine on numbers like "1.05". Then it returns "1,05". But on numbers like "1.005" it returns
"1005". What is wrong? Is this an Excel bug?

Posted by Celia on September 22, 2000 6:26 AM

I've just run your code and it worked for me.
It returned "1,05" and "1,005".

Posted by Celia on September 22, 2000 6:38 AM

Check the cell format. It may be a number format of ###0 whereas it should be #,##0