To check for a valid number, you can use the isnumeric function in the leave event in the text box. If it is not numeric, set focust back to text box 1. Compare the value of int (x) with x to see if it is integer.
If Not IsNumeric(txAngle.Text) Then
MsgBox("Enter a number between -360 and 360.")
txAngle.Focus()
else
x = CDbl(txAngle.Text)
if int(x) <> x then ' test for integer
...
end if
source
share