The following VBA code attached to a textbox will allow entry of digits (0 to 9)
only. Change TextBox1 throughout to the name of your textbox.
Private Sub TextBox1_Change()
If Len(TextBox1.Text) > 0 Then
TextBox1.Text = NbrOnly(TextBox1.Text)
End If
End Sub
Private Function NbrOnly(Intxt As String) As String
Dim zz As Long, OutStr As String
For zz& = 1 To Len(Intxt$)
Select Case Mid(Intxt$, zz&, 1)
Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
OutStr$ = OutStr$ & Mid(Intxt$, zz&, 1)
Case Else
'do nothing
End Select
Next zz&
NbrOnly$ = OutStr$
End Function