Here's a more robust function:
[Edited by r0ach on 11-16-2000 at 01:52 AM]Code:Private Function IsInRange(ByVal num as Integer, ByVal min as Integer, ByVal max as Integer) as Boolean 'Set a default return value IsInRange = False If (num => min) and (num <= max) Then IsInRange = True End If End Function 'Usage: If IsInRange(Val(Text1), 2, 8) Then MsgBox "OK" Else MsgBox "Not OK" End If 'Or check a number between 5 and 25 If IsInRange(Val(Text1), 5, 25) Then MsgBox "OK" Else MsgBox "Not OK" End If




Reply With Quote