Thread: Spaces
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Wild Bill[_2_] Wild Bill[_2_] is offline
external usenet poster
 
Posts: 90
Default Spaces

Dim cel As Range
For Each cel In ActiveSheet.UsedRange
If Left(cel.Value, 1) = " " Then cel.Value = Mid(cel.Value, 2)
Next

is one way, but you probably really want to use ltrim. This only gets
one at a time.

On Wed, 27 Aug 2003 03:28:58 -0700, "Steve Wylie"
wrote:

I also need another short macro that could go through an
entire sheet deleting a space where it found it at the
beginning of a cell, but not in any other part of the
cell's contents, eg it would delete the space from

example

turning it into

example

but where it found

this example

it would only delete the space from the beginning of the
cell, not the space between the words.