Reputation: 103
I would like to have an excel VBA macro in order to replace all "." (dot) by "," (comma) in a column in one sheet.
When I try to do it with the following code, it replaces only if the cell value is ".". But does not replace "." inside cell value (i.e : 1.16 should be turned to 1,16 in column D inside sheet5)
Sub ReplaceDoTwComma()
Worksheets("Sheet5").Columns("D").Replace _
What:=".", Replacement:=",", _
SearchOrder:=xlByColumns, MatchCase:=True
End Sub
Can someone give me the good code to do this?
Thanks in advance...
Upvotes: 0
Views: 15357
Reputation: 2917
Add the LookAt:=xlPart
option.
Worksheets("Sheet5").Columns("D").Replace _
What:=sought, replacement:=replaced, LookAt:=xlPart
Upvotes: 1
Reputation: 11
you don't need a macro for this, just select the column in question in excel > Crtl + h and in find what put "." and in replace with put "," and hit replace all
Upvotes: 0