View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John[_22_] John[_22_] is offline
external usenet poster
 
Posts: 694
Default Can't replace commas with period

Hi Dave
Thank you for your help.
The commas are decimal separators and I need to change it to a period.
I did try manually to type the commas and to see if it would remove them but to
no availed.
If I use the "Find/Replace" menu, I can make it work but I get an error message.
even if I get an error, it still makes the corrections.
Regards
John



"Dave Peterson" wrote in message
...
Maybe the values in the cells don't contain commas. Maybe they're just plain
old numbers formatted to show commas (either as the thousands separator or the
decimal point????).

John wrote:

Hi Everyone

Below are my codes that I use to clean my data coming from the internet.
They all work except the first one (Find all the commas "," and replace with
a
period (.) )
Can anyone tell me why?

Option Explicit

Sub Clean_Data()

Range("J3:L60").Select
Cells.Replace What:=",", Replacement:=".", LookAt:=xlPart, SearchOrder _
:=xlByColumns
Range("J3:L60").Select
Cells.Replace What:="$", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByColumns

Range("J3:L60").Select
Cells.Replace What:=" ", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByColumns

' ALT-0160
Range("J3:L60").Select
Cells.Replace What:=" ", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByColumns

End Sub

Regards
John


--

Dave Peterson