White space removal
What does "^w" mean to you?
Try this to remove all spaces.
Public Sub Strip_WhiteSpace()
Selection.Replace what:=" ", _
replacement:="", lookat:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End Sub
If the spaces are html non-breaking spaces.
Public Sub Strip_WhiteSpace()
With Selection
.Replace what:=Chr(160), replacement:="", _
lookat:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
.Replace what:=" ", _
replacement:="", lookat:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End With
End Sub
Gord Dibben MS Excel MVP
On Wed, 14 Oct 2009 18:21:06 +0100, "camlad" wrote:
I need to remove white space from a range so I recorded the following which
did not work.
How can I remove all spaces in a range?
Range("A1:A535").Select
Selection.Replace What:="^w", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Camlad
|