View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JP[_4_] JP[_4_] is offline
external usenet poster
 
Posts: 897
Default Need macro to trim characters in column

Sub trimit()

Dim cell As Excel.Range

For Each cell In Selection
cell = Left(LTrim(cell), 21)
Next cell

End Sub


HTH,
JP

On Jan 10, 11:21*am, TonyV wrote:
I have a 100 lines in column A in my excel 2003 spreadsheet, each containing
various lengths of text, and need to trim each cell to contain the first 21
characters only & discard the rest.

I will be greatful if someone can assist me in writing a macro to get this
done that will be equivalent the LEFT formula.

Thankyou.