Excel VBA‎ > ‎

Text Operations in VBA

Test if string is composed of only letters. Return true if it is.




Function IsLetter(strValue As String) As Boolean

    Dim intPos As Integer
    For intPos = 1 To Len(strValue)
        Select Case Asc(Mid(strValue, intPos, 1))
        Case 65 To 90, 97 To 122

            IsLetter = True

        Case Else

            IsLetter = False

            Exit For

        End Select
    Next

End Function