Coding a function

J

Junior

In a function, I want to test if varAssn (string)
and it IS NOT between "01 and "28" set a variable
what is the proper code? thanks

If varAssn < "01" And varAssn > "28" Then X="ZZZ"
 
R

Rick Brandt

Junior said:
In a function, I want to test if varAssn (string)
and it IS NOT between "01 and "28" set a variable
what is the proper code? thanks

If varAssn < "01" And varAssn > "28" Then X="ZZZ"

A value could not be both less than "01" AND be greater than "28". You
need to use OR instead.
 
J

Junior

OK thanks -
So if i want to set a variable say X="Error"
whenever varAssn IS NOT between "01" and "28"
what would the code look like in a function.
 
R

Rick Brandt

Junior said:
OK thanks -
So if i want to set a variable say X="Error"
whenever varAssn IS NOT between "01" and "28"
what would the code look like in a function.

It would look exactly like what you posted in your original question except the
word "and" would be replaced with the word "or".
 

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