Thread: Textbox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Textbox

try something like this

Function TestString(TestStr As String)

TestString = True
If Not IsNumeric(TestStr) Then
For i = 1 To Len(TestStr)
TestChar = UCase(Mid(TestStr, i, 1))

If Asc(TestChar) < Asc("A") Or _
Asc(TestChar) Asc("Z") Then

TestString = False
Exit For
End If
Next i
End If

End Function

"ranswrt" wrote:

How do I make sure that whatever is entered in a textbox on a userform is a
letter of the alphabet or a number only?
Thanks