Hi All,
I am trying to write a simple code using a string function, or perhaps using another function I am not aware of.
This is what I want to do, but don't know how to write this code using correct VBA syntax.
Function code (x)
If x equals to one of the values in the following list (1,2,3,4, 5)
then code = "Alpha"
else code = ""
end if
end Function
In the past, I would just write:
x = 1 or x =2 or x =3 or x =4 or x = 5
Then code = "Alpha"
But this writing style can get very time consuming when working with a lot more variables.
Thanks for the help.
- Henry
I am trying to write a simple code using a string function, or perhaps using another function I am not aware of.
This is what I want to do, but don't know how to write this code using correct VBA syntax.
Function code (x)
If x equals to one of the values in the following list (1,2,3,4, 5)
then code = "Alpha"
else code = ""
end if
end Function
In the past, I would just write:
x = 1 or x =2 or x =3 or x =4 or x = 5
Then code = "Alpha"
But this writing style can get very time consuming when working with a lot more variables.
Thanks for the help.
- Henry