IF criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone tell me if the IF statement will accept something like this:

IF (testnum = 202, 203, 204, 205, 265, 266, 268) Then
DO THIS
ELSE
DO THIS


I am looking for an easier way of doing the following:

IF (testnum >= 202) AND (testnum <=205) Then
DO THIS
ElseIf (testnum >=265) AND (testnum <=268) Then
DO THIS
Else
DO THIS


Any ideas are appreciated....

Cheers
 
Paul B. said:
Can someone tell me if the IF statement will accept something like this:

IF (testnum = 202, 203, 204, 205, 265, 266, 268) Then
DO THIS
ELSE
DO THIS


I am looking for an easier way of doing the following:

IF (testnum >= 202) AND (testnum <=205) Then
DO THIS
ElseIf (testnum >=265) AND (testnum <=268) Then
DO THIS
Else
DO THIS


Any ideas are appreciated....

Cheers

I tend to use Select...Case for something like this:

Select testnum
Case 202, 203, 204, 205, 265, 266, 268
DO THIS
Case Else
DO THIS
End Select
 
Back
Top