first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Code: Return only Numbers and Digits (Optional) from a String; basGetDigits()

Public Function basGetDigits(ByVal Literal as String, _ Optional ByVal InclDec = False) As String

Dim lngCount As Long
Dim strChar As String
Dim strRet As String
Dim strCmp As String

If InclDec Then
    strCmp = "1234567890."
Else
    strCmp = "1234567890"
End If

For lngCount = 1 To VBA.Len(str)
    strChar = VBA.Mid$(str, lngCount, 1)
    If VBA.InStr(strCmp, strChar) > 0 Then
        strRet = strRet & strChar
    End If
Next

basGetDigits = strRet

End Function

mod date: 1999-01-12T05:35:05.000Z