Can't replace commas with period
ps
Range("J3:L60").Select
Cells.Replace What:=" ", Replacement:="", LookAt:=xlPart, SearchOrder:= _
xlByColumns
could be re-written:
Range("J3:L60").Replace What:=chr(160), Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByColumns
You could drop the .select's from all your code. And the chr(160) is a little
more self-documenting.
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
|