View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] denisu.pong@gmail.com is offline
external usenet poster
 
Posts: 4
Default How to create a check to allow user to input numerics from the numeric pad

Private Sub txtZip_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
' Pass through only digits.
If KeyCode < 48 Or KeyCode 57 Then
KeyCode = 0
Beep
End If

' As I found out the numerics from the numeric pad range from 0x60 to
0x69
' Could someone show me how to set up a valid check for them ?
If KeyCode < "0x60" Or KeyCode "0x69" Then
KeyCode = 0
Beep
End If


End Sub