Sub main() MsgBox getNumber("adfa23adf42342") End Sub
Function getNumber(str As String) As Double Dim str1 As String, num As Integer, numStr As String For num = 1 To Len(str) If Asc(Mid(str, num, 1)) >= 48 And Asc(Mid(str, num, 1)) <= 57 Then numStr = numStr & Mid(str, num, 1) Next getNumber = Val(numStr) End Function