Hi Nam,
Try:
'=============>>
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object
Set oRegExp = CreateObject("VBScript.RegExp")
With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"
DigitsOnly = CLng(.Replace(sStr, vbNullString))
End With
End Function
'<<=============
A1: 589as56
B1 = DigitsOnly(A1) ==> 58956
---
Regards,
Norman
"lehainam" <lehainam.28ee8y_1148618701.4952@excelforum-nospam.com> wrote in
message news:lehainam.28ee8y_1148618701.4952@excelforum-nospam.com...
>
> Dear all,
>
> In Excel, is there any function that I can get number only in string
> that has number & text
>
> Ex: in cell A1 589as56
> I would like to get the string 58956 only
>
> Thank you very much
>
> Nam
>
>
> --
> lehainam
> ------------------------------------------------------------------------
> lehainam's Profile:
> http://www.excelforum.com/member.php...o&userid=18615
> View this thread: http://www.excelforum.com/showthread...hreadid=545735
>
Bookmarks