Hi,
Here's a generic function that simply returns all numbers within a string:
Public Function GetNumbers(strIn As String) As Long
Dim i As Integer
Dim strNum As String
On Error GoTo num_err
For i = 1 To Len(strIn)
If IsNumeric(Mid(strIn, i, 1)) Then
strNum = strNum & Mid(strIn, i, 1)
End If
Next
GetNumbers = CLng(strNum)
Exit Function
num_err:
GetNumbers = -1
End Function
--
HTH
-------
Dan Artuso, MVP
"Gina" <
[email protected]> wrote in message news:
[email protected]...
> Hi.
>
> a textbox contains numbers and characters
> .... how can I only extract the numbers from that field for some
> calculations ?
>
> thanks,
> Gina
>
>