leading and ending space

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
 
J

Jacob Skaria

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
 

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

Top