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 "D",
You would need a macro. Posting to anyone of these
groups gets read by the same people. But at least
we know you know about macros (programming).

There is an LTRIM in VBA so you can use the VBA
function. For rest of macro see
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
you would want to give it a different name like LtrimAll
 
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
_ _
^¢¯^
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top