If your "variable" has a continuous range of values, you can do the following:Code:Option Explicit Private Enum aniAnimals [aniLow] = 3 aniDog = 3 aniCat = 4 aniMouse = 5 [anihigh] = 5 End Enum Private Sub Text1_Change() If Len(Trim(Text1)) > 0 Then If Val(Text1) < aniLow Or Val(Text1) > anihigh Then MsgBox "Please enter an animal number (a value from 3 to 5)" Else MsgBox "Thanks" End If End If End Sub




Reply With Quote