how do i eliminate leading 0 in a text cell

G

Guest

I have ID numbers that are alpha numeric. Some are all numeric formatted as
text, others are actual alpha numeric combinations. Most all have leading
"0s". I want to easily eliminate them.
 
G

Guest

Enter this macro:

Sub zeroplucker()
For Each r In Selection
If Left(r.Value, 1) = "0" Then
Do
r.Value = Right(r.Value, Len(r.Value) - 1)
If Left(r.Value, 1) <> "0" Then
Exit Do
End If
Loop
End If
Next
End Sub

Then select the cells you want to fix and run the macro.
 

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