G'day,
I need to see if a variable is within certain ranges, but I can't remember how to do it.PeterVB Code:
If not x in [1 .. 12, 31, 32, 35 .. 45] then
Printable View
G'day,
I need to see if a variable is within certain ranges, but I can't remember how to do it.PeterVB Code:
If not x in [1 .. 12, 31, 32, 35 .. 45] then
Try this:
VB Code:
Select Case Val(x) Case 1 To 12, 31, 32, 35 To 45: MsgBox "in range" Case Else MsgBox "not in range" End Select
G'day Pokey,
Thanks for that. For some unknown reason, I thought I could do it as a single statement, but whilst lying in bed last night I started to have doubts and realised I would have to use the select statement.
Peter