View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andrew[_19_] Andrew[_19_] is offline
external usenet poster
 
Posts: 2
Default Macro to remove leading space

Thank you so much. It works great. This is going to be a REAL
motivator to start learning!


"Tom Ogilvy" wrote in message ...
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