leading and ending space

  • Thread starter Thread starter scharee
  • Start date Start date
S

scharee

i need to create a macro that will remove leading and ending extra spaces
without disturbing a leading "0" of a number in a cell eg. 03222 should
remain the same n not 3222
 
Try the below and feedback..

Sub Macro()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If Not cell.HasFormula Then cell.Value = Trim(cell.Text)
Next
End Sub

If this post helps click Yes
 
Back
Top