Thread
:
pulling out Numbers
View Single Post
#
2
Posted to microsoft.public.excel.misc
Sandy Mann
external usenet poster
Posts: 2,345
pulling out Numbers
I think that it does remove leading zeros Mike. Is it not necause you
format the cell as General?
--
Regards,
Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings
Replace @mailinator.com with @tiscali.co.uk
"Mike H" wrote in message
...
Hi,
It doesn't I suspect the zero is a letter "o" or "O"
Mike
"peyman" wrote:
hi Mike,
the problem is , it removes the zero at the begining of a numbers after
pulling out them,like:
aab0125 turns to 125 instead of 0125
"Mike H" wrote:
Another way.
I'm a bit cofused why the previous method only removed th dash but try
this
Sub anotherway()
For Each cell In Selection
For a = 1 To Len(cell)
Select Case Mid(cell, a, 1)
Case "0" To "9"
newstring = newstring & Mid(cell, a, 1)
End Select
Next a
cell.Value = newstring
ActiveCell.NumberFormat = "General"
newstring = ""
Next cell
End Sub
Mike
"peyman" wrote:
hi Mike,
it just removes dash "-" from string!! not letters.
"Mike H" wrote:
With a macro:-
Sub removeletters()
For Each cell In Selection
For a = 1 To Len(cell)
If Asc(Mid(cell, a, 1)) 47 And Asc(Mid(cell, a, 1)) <
59 Or _
Asc(Mid(cell, a, 1)) 64 And Asc(Mid(cell, a, 1))
< 91 Then _
newstring = newstring & Mid(cell, a, 1)
Next
cell.Value = newstring
ActiveCell.NumberFormat = "General"
newstring = ""
Next
End Sub
Select the cells to convert and run this
Mike
"peyman" wrote:
hi,
how can I pull out numbers from a string?like:
aa012985 to 012985
12ab-059 to 12059
the letters or characters might be either at the first, middle or
at the end
of a string.
thanx in advance.
Reply With Quote
Sandy Mann
View Public Profile
Find all posts by Sandy Mann