how do i delete spaces in multiple cells thoughout the workbook?

  • Thread starter Thread starter Starr
  • Start date Start date
S

Starr

I have a list of 1,400 names, most of which have 2 spaces preceding the name.
i would like to remove all the space. I read to put 2 spaces in the FIND &
the following in REPLACE WITH: =--substitute(a1,char(160),"") but that
didn't work possibly because it was posted in 2007.
 
A couple ideas:

Sub Remove_CR_LF()
With Selection
..Replace What:=Chr(160), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
..Replace What:=Chr(13) & Chr(10), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
..Replace What:=Chr(10), Replacement:=Chr(32), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
End With
End Sub

Sub tic_killer()
Set rr = ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants, xlTextValues)
For Each r In rr
If r.PrefixCharacter = "'" Then
r.Value = r.Value
End If
Next
End Sub

HTH,
Ryan---
 
Back
Top