View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Extract Number with zero

Public Function ReturnNumerals(rng As Range) As String
Dim sStr As String, i As Long, sStr1 As String
Dim sChar As String
sStr = rng.Value
For i = 1 To Len(sStr)
sChar = Mid(sStr, i, 1)
If sChar Like "[0-9]" Then
sStr1 = sStr1 & sChar
End If
Next
Debug.Print sStr, sStr1
ReturnNumerals = sStr1
End Function


Put in a general module

--
Regards,
Tom Ogilvy



--
Regards,
Tom Ogilvy

"ltong" wrote in message
om...
Hi,

How to device an excel function or excel VBA to extract only the
number together with zero?, for the following : -

1) hgl5480,k00l92 =1548000192
2) mkg00152mn(a01,4) =00152014
3) OR00000254600 =00000254600
4) jdwoqp00p054v-gdw0014 =000540014
5) jkh4025lop05'0960 =4025050960

Thanks in advance

Regards
Lenard