View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
wjd01 wjd01 is offline
external usenet poster
 
Posts: 4
Default Removing preceeding spaces

Thanks for the suggestion. It worked great.

wjd01


-----Original Message-----
The LTrim function will trim only spaces on the left,

leaving the
rest intact. Try something like


Sub AAA()
Dim Rng As Range
For Each Rng In Range("A1:A10") ' << CHANGE Range
Rng.Value = LTrim(Rng.Text)
Next Rng
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com







"wjd01" wrote in message
...
When opening specific text documents in excel, the text

is
captured with 6 or 7 preceeding spaces (this is
expected). I'm looking for a macro that will remove

only
the preceeding spaces, but not touch any spaces that
appear after the first character of text. Is there a
macro that can remove these? I have tried to setup a
macro that copies and pastes values...etc. but to no
avail. The spaces are always carried along.

Thanks for your suggestions.

wjd01



.