How do I apply LTRIM to entire Sheet?

  • Thread starter Thread starter D
  • Start date Start date
D

D

Hey guys-
I have an entire sheet filled with data. Many columns/rows have spaces at
the beginning of the cell. Many cells have multiple words in them, so a
simple Find/Replace wont work. I need to use LTRIM across the entire
worksheet so it deletes out all the leading spaces. How can this be done
easily???
Thanks
D
 
Hi,

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sub TEST()

Dim CL As Range
Dim RNG As Range

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

On Error Resume Next
Set RNG = Cells.SpecialCells(xlConstants, xlTextValues)
For Each CL In Intersect(Selection, RNG)
CL.Value = LTrim(CL.Value)
Next
On Error GoTo 0

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


--
Regards,
Soo Cheon Jheong
_ _
^¢¯^
--
 
Back
Top