select case with dual criterias

  • Thread starter Thread starter Jesper F
  • Start date Start date
J

Jesper F

This function returns 1 even though I feed it 5 and I don't understand why.

Function t(i As Integer)
Select Case i
Case Is > 1, Is < 5
t = 1
Case Is > 4, Is < 11
t = 2
End Select
End Function

Can you help? Thanks.

/ Jesper
 
Function t(i As Integer)
Select Case i
Case 2 To 4
t = 1
Case 5 To 10
t = 2
End Select
End Function

Using commas in a Case Ors them together. You need And, which isn't
supported.
 
Back
Top