Page 1 of 1

If Command Question

Posted: Tue Sep 30, 2008 5:47 pm
by warrenk
If tColor = 'RED' or tColor = 'BLUE' or tColor = 'Green', etc.

Is there a way to change the above if statement when I can give a list or values?

I know the syntax is not correct, but something like this...

If tColor = ('RED', 'BLUE', 'GREEN') then...

Thanks!
Warren

Posted: Tue Sep 30, 2008 6:17 pm
by BvG
if tColor is among the items of "red,green,blue" then

watch out to not include spaces thoug ("green" <> " green")

Posted: Tue Sep 30, 2008 6:18 pm
by SparkOut

Code: Select all

if tColor is among the items of "RED,BLUE,GREEN" then...
should be what you need.
(Although you could spell tColour properly :wink: )

or

Code: Select all

if tColor is among the words of "RED BLUE GREEN" then...
Look up "is among" anyway.

Posted: Tue Sep 30, 2008 6:21 pm
by warrenk
Thanks again SparkOut!

Had to laugh at the Color comment. Coming from Canada, we spell it either Color or Colour...both are correct in Canada.

Since I now live in the USA...I guess I am incorrect with the spelling. :oops:

a color is not always a color name when tested

Posted: Tue Sep 30, 2008 7:02 pm
by Jerry Daniels
Sometimes I've set the forecolor of something to "red" and then when I test it later, it's 255,0,0, not "red".