View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default TextBox and KeyCode

Sorry about that

Private Sub ZipCode_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
With Me.ZipCode
Select Case True
Case (KeyCode = 96 And KeyCode < 105) 'numeric keypad
'exit quietly
Case (KeyCode = 48 And KeyCode < 57) 'normal keypad
'exit quietly
Case KeyCode = 8 'backspace
If Len(.Text) 0 Then
.Text = Left(.Text, Len(.Text) - 1)
End If
KeyCode = 0
Case Else
KeyCode = 0
Beep
End Select
End With
End Sub


--
HTH

Bob Phillips

"Darrin Henshaw" wrote in message
...
Thanks Bob. That takes care of the need to backspace, but any ideas on
how to allow them to use the numeric keypad?

*** Sent via Developersdex http://www.developersdex.com ***