Change Dot to Comma

MrThor

New Member
Joined
Aug 13, 2018
Messages
36
Hi

I want to find all my dots in my excel sheet and replace them with Comma. I used the macro recorder to try to find a way and got the code below. However it doesnt work, if I have a number like 12345.6789 it will turn to 123456789 after the macro. Anyone knows how to fix it?

Code:
    Cells.Replace What:=".", Replacement:=",", LookAt:=xlPart, SearchOrder _
        :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
 

Some videos you may like

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
Hi,

You can test Chr(46) and Chr(44) to replace "." and ","

Hope this will help
 

Repush

Board Regular
Joined
Sep 21, 2015
Messages
133
Office Version
  1. 2013
Platform
  1. Windows
replace is a string operator . .
tested with '12345.6789 your code works: result '12345,6789
what is the source? manual typed numbers or imported?
 

Repush

Board Regular
Joined
Sep 21, 2015
Messages
133
Office Version
  1. 2013
Platform
  1. Windows
[B3].Value = Replace([B3], ".", ",")
strange things happen here . . . cell formatting has influence
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,109,043
Messages
5,526,423
Members
409,701
Latest member
nitmani

This Week's Hot Topics

Top