This will only allow numbers 0-9:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Beep
End If
End Sub
This will allow one decimal:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim x As Integer
Dim y As String
If KeyAscii < 46 Or KeyAscii > 57 Or KeyAscii = 47 Then
KeyAscii = 0
Beep
End If
If KeyAscii = 46 Then
y = TextBox1.Text
For x = 1 To Len(y)
If Mid(y, x, 1) = "." Then KeyAscii = 0
Next x
End If
End Sub