Replacing spaces with zeros
Cells.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
This statement replaces empty strings "".
Try
Cells.Replace What:=" ", Replacement:=0, LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
but first check that you want to replace all spaces in all cells
(LookAt:=xlPart) or only those standing alone in a cell (LookAt:=xlWhole)
Regards,
Stefi
€˛Oldjay€¯ ezt Ć*rta:
I have the following
Sub FillZeros()
Sheets("Records").Select
Range("N2:N500").Select
Application.CutCopyMode = False
Cells.Replace What:="", Replacement:=0, LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
End Sub
When I run it I get 5 additional cols of zeros
Oldjay
|