Jacque Scott
asked on
IF...Statement with (n) number of OR's
I need to create an If...Else...Statement where there is going to be multiple 'OR's and I need help on the best way to do this.
Here is my If...Statement where I only have one 'OR'.
If sSFPRNumber = "7185" Or sSFPRNumber = "7481" Then
nOutsideProvider = 0
Else
nOutsideProvider = 1
End If
I now have all of the numbers in an array and I would like to loop through the array to create the above IF...Statement.
What is the best way to accomplish this?
Here is my If...Statement where I only have one 'OR'.
If sSFPRNumber = "7185" Or sSFPRNumber = "7481" Then
nOutsideProvider = 0
Else
nOutsideProvider = 1
End If
I now have all of the numbers in an array and I would like to loop through the array to create the above IF...Statement.
What is the best way to accomplish this?
ASKER
do I need to say nOutsideProvider = x(sSFPRNumber)
couldn't I just use nOutsideProvider = 0
couldn't I just use nOutsideProvider = 0
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was going to use the For...Each but this is nested in another For.. loop and I was trying to get away from looping so many times.
I am going to give this a try. Thanks.
I am going to give this a try. Thanks.
ASKER
Can you have a multi-dimensional dictionary object?
you could try creating a dictionary object and then checking if the value exists in the list.
If you reference microsoft scripting runtime and do
Dim x as new dictionary
x.add 7185, 0 'the second number is the value returned if this number is the check
x.add 7481, 0
if x.exists(sSFPRNumber) then
nOutsideProvider = x(sSFPRNumber)
else
nOutsideProvider = 1
end if