View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Text Box for Numeric Data

Harald Staff often recommends the keypress event and I endorse that. Here
is recent code Harald posted:

Private Sub TxtBox_KeyPress(ByVal keyascii As MSForms.ReturnInteger)
Select Case keyascii
Case 8 To 10, 13, 27, 44 'Control characters
Case 48 To 57 'numbers
Case Else 'Discard anything else
keyascii = 0
End Select
End Sub


--
Regards,
Tom Ogilvy






Chrissy wrote in message
...
Does anyone have some standard code they use to turn
a text box into a numeric data entry box?

If not, how do you handle data validation for entries you
want to restrict to numeric values?

Chrissy.