View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Michael H. Michael H. is offline
external usenet poster
 
Posts: 3
Default delete trailing space in column

If familiar with VBA you could write a loop using the Trim function.

Drop a button on the sheet and paste in the following... (Note will
need to substitute "Sheet1" with the name of your sheet.)

Private Sub CommandButton1_Click()

Dim intRow as integer
Dim strCell as string

intRow = 2
intCol = "B"
strCell = "B" & Cstr(intRow)

Do While Len(strCell) 0
Worksheets("Sheet1").Range(strCell) = Trim(Worksheets
("Sheet1").Range(strCell))
intRow = intRow + 1
strCell = intCol & Cstr(intRow)
Loop

End sub

Good luck!

On Apr 27, 1:31*pm, "J.W. Aldridge"
wrote:
B2:B10000 consist of what supposed to be dates.
The only problem is, when I attempt to change format, it wont take.
Found out the problem is a trailing space at end.

I have tried several delete space codes, but to no avail.

Please.... any suggestions to delete trailing spaces?

2009-05-02*