Thread: Textbox values
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Textbox values

This'll stop the typing of anything but digits:

Option Explicit
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
'numbers
Case Asc("0") To Asc("9")
'ok
Case Else
KeyAscii = 0
Beep
End Select
End Sub

Brad wrote:

I have a userform with some text boxes on them. I need to find a way to
restrict what the user can enter to integer values only. Any suggestions?


--

Dave Peterson