Does the string include a number

Function to determine if a string includes a number.
Returns boolean value.
Author: michael@excelexperts.co.uk

Function HasNumber(strData As String) As Boolean

    Dim iCnt As Integer

    For iCnt = 1 To Len(strData)
        If IsNumeric(Mid(strData, iCnt, 1)) Then
            HasNumber = True
            Exit Function
        End If
    Next iCnt

End Function

Address

Brookfield,
55 Heath Drive
Brookwood, Surrey
GU24 0HQ England

Scroll to Top