Remove spaces


Posted by Andonny on May 11, 2001 5:22 AM

Hi,
I would like to remove spaces in front of a word if there are any with a macro. All the words are located in column B.

Your help is very much appreciated
Andonny

Posted by Denis on May 11, 2001 5:53 AM

Try running a macro that looks for " " and replaces it with "".
That should work.
Denis

Posted by Mark W. on May 11, 2001 6:36 AM

Just have your macro call Excel's TRIM() function.

Posted by bill anderson on May 11, 2001 8:52 AM



Posted by Andonny on May 11, 2001 5:40 PM

Hi,
I ended up using this code.

Sub TrimSpaces()
For Each rng In Range("B:B"). _
SpecialCells(xlCellTypeConstants, xlTextValues)
rng.Value = LTrim(rng.Value)
Next rng
End Sub

Thanks for everybodies help.
Andonny