#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default pulling out Numbers

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.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,345
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
formula for pulling only numbers but not text from another cell Jamie Excel Worksheet Functions 7 May 17th 07 07:56 PM
function for pulling certain numbers from a cell? datasorter Excel Worksheet Functions 3 August 3rd 06 12:30 AM
Pulling the largest numbers Melanie Excel Worksheet Functions 2 May 23rd 06 07:33 PM
pulling numbers from hhh:mm:ss tri_p Excel Worksheet Functions 2 October 3rd 05 08:36 PM
Pulling larger numbers from group Smint Excel Worksheet Functions 3 June 14th 05 08:55 PM


All times are GMT +1. The time now is 05:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"