In a similar vein, the following code ensures only numbers can be input. Any non-numeric keystroke generates a beep and the offending character is deleted.
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Not (KeyAscii > 47 And KeyAscii < 59) Then
 Beep
 KeyAscii = 0
End If
End Sub
Or, if you want to allow the user to input decimal values:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Not (KeyAscii > 47 And KeyAscii < 59) Then
  If KeyAscii = 46 And Len(TextBox1.Text) = 0 Then
    TextBox1.Text = "0"
  ElseIf Not (KeyAscii = 46 And InStr(TextBox1.Text, ".") = 0) Then
    Beep
    KeyAscii = 0
  End If
End If
End Sub
Note: With the second sub, only a single period can be input, and a leading 0 is automatically inserted if the period is the first character input by the user.