I am having trouble trimming spaces in excel. I have searched the forum at attempted several macro's including the one below:
Sub TrimSpaces()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants)
cell = WorksheetFunction.Trim(cell)
Next cell
End Sub
But I still have the extra spaces. I have also just tested a few cells by using the trim () function, and I still get extra spaces after the words. I have done the trim function in the past and not had a problem. Is there something potentially wrong with my excel? or do I have my field in an incorrect format?
Thanks for any help you can give, I am a fairly inexperienced user.
Sub TrimSpaces()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants)
cell = WorksheetFunction.Trim(cell)
Next cell
End Sub
But I still have the extra spaces. I have also just tested a few cells by using the trim () function, and I still get extra spaces after the words. I have done the trim function in the past and not had a problem. Is there something potentially wrong with my excel? or do I have my field in an incorrect format?
Thanks for any help you can give, I am a fairly inexperienced user.