Hello,
I'm trying to write a vba statement to check that the user has entered an integer in my userform text box between 3 and 6. This is what I have so far:
I'm trying to write a vba statement to check that the user has entered an integer in my userform text box between 3 and 6. This is what I have so far:
Code:
If TestNumBox.value <> 3 Or TestNumBox <> 4 Or TestNumBox <> 5 Or TestNumBox <> 6 Then
'TestNumBox is not an integer between 3 and 6, need a message alerting user.
MsgBox "The number of steps in the test must be an integer between 3 and 6.", , "Please check the number of steps in test."
TestNumBox.SetFocus
Exit Sub
Else 'Everything is filled in correctly. Exit if statment and unload the BasicData form.
End If
[\code]
As far as I know my if statment says if the the testnumbox (i.e. the textbox value is not equal to 3, or not equal to 4 or not equal to 5 or not equal to 6 then do the message box otherwise continue.
But it always goes into the message box routine and never exits the if.
Any ideas?
Thanks Hayden