Brian Mulder
asked on
Select case and OR statement
Hi everyone,
while stepping through code in excel i saw this
-somevalue has the value of 36.8
-in the debugger
-?Range("J" & iRow - 4) gave 0
-?Range("L" & iRow - 4) gave 36.8
so you would expect this statement to be true and teh code go into dosomething
select case somevalue
case is = Range("J" & iRow - 4) Or Range("L" & iRow - 4)
dosomething
'......more comes here
end select
-the following worked as expected
select case somevalue
case is = Range("J" & iRow - 4)
dosomething
case is = Range("L" & iRow - 4)
'......more comes here
end select
-in the debugger the statement Range("J" & iRow - 4) Or Range("L" & iRow - 4) gave 37!
am i missing something here, it's not a real problem only a question maybe i'm doing something wrong in using the OR statement in the case select
:O)Bruintje
while stepping through code in excel i saw this
-somevalue has the value of 36.8
-in the debugger
-?Range("J" & iRow - 4) gave 0
-?Range("L" & iRow - 4) gave 36.8
so you would expect this statement to be true and teh code go into dosomething
select case somevalue
case is = Range("J" & iRow - 4) Or Range("L" & iRow - 4)
dosomething
'......more comes here
end select
-the following worked as expected
select case somevalue
case is = Range("J" & iRow - 4)
dosomething
case is = Range("L" & iRow - 4)
'......more comes here
end select
-in the debugger the statement Range("J" & iRow - 4) Or Range("L" & iRow - 4) gave 37!
am i missing something here, it's not a real problem only a question maybe i'm doing something wrong in using the OR statement in the case select
:O)Bruintje
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think that the .Value tries to read an integer value.
Try reading it as a string ?
Try reading it as a string ?
ASKER
that did it!
thanks a lot learned something new because in VB i did the same thing Case Is = but Case X,Y seems logical
:O)Bruintje
thanks a lot learned something new because in VB i did the same thing Case Is = but Case X,Y seems logical
:O)Bruintje
thanks 4 points & Grade
LOL - Overread that one..... ;-)
Great catch Bahnass!
D'Mzzl!
RoverM
Great catch Bahnass!
D'Mzzl!
RoverM
ASKER
Case Is = Range("J" & iRow - 4): Case Is = Range("L" & iRow - 4)
which worked ok but i still want to know about the case select and the OR