View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default only letters in text box

This allows keyboard entries space, A-Z and a-z only:

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 32, 65 To 90, 97 To 122
Case Else
KeyAscii = 0
End Select
End Sub

See or make a character map for other allowed characters and symbols. This
does not handle Ctrl V, do that with code in the KeyDown event if required.

HTH. Best wishes Harald.

"JNW" skrev i melding
...
I know about the IsNumber function. I was wondering if there is a similar
function to only allow letters in the text box. The IsText worksheet
function won't cut it.

Thanks!