Another basic question... CASE with a range

P

Phillips

How would I do the following? I can not find anything about AND/OR in the
VBA help file...


if a is equal to and greater than x and if a is less than z
q=1

if a is equal to and greater than b and if a is less than c
q =2

if a is equal to and greater than e and if a is less than f
q=3

otherwise

q = 0

etc...

Thank you
Phil
 
H

Henry

Phillips,

what do you want q to be if
a is equal to and greater than x and if a is less than z
AND
a is equal to and greater than b and if a is less than c
AND
a is equal to and greater than e and if a is less than f?

Henry
 
T

Tom Ogilvy

Select Case True
Case a >= x and a < z
q = 1
Case a >= b and a < c
q = 2
Case a >= e and a < f
q = 3
Case else
q = 0
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top