View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Macro to remove leading space

Sub RemoveSpace()
Dim cell As Range

For Each cell In Selection
If Not cell.HasFormula Then
If Not IsEmpty(cell) Then
If Left(cell.Value, 1) = " " Then
cell.Value = Right(cell.Value, _
Len(cell.Value) - 1)
End If
End If
End If
Next
End Sub


--
Regards,
Tom Ogilvy


Andrew wrote in message
om...
I am just now getting into writing macros so I think this task may be
above me for now. Could some kind person give me a hint on writing a
macro that would check for, and if it exists, remove a single space
that is the first character in a cell from a selected set of cells.

Many thanks in advance for your time
Andrew