ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Going nuts on this one... (https://www.excelbanter.com/excel-programming/379982-going-nuts-one.html)

AD108

Going nuts on this one...
 
I can't figure out why the following expression is evaluating to True when
UCase(z(i, 1)) is equal to ""
What am I missing here. Thanks in advance for any help.

If UCase(z(i, 1)) < "CS" And UCase(z(i, 1)) < "" And UCase(.Cells(intPos,
8)) = "CS" Or UCase(.Cells(intPos, 8)) = "" Then




Tom Ogilvy

Going nuts on this one...
 
? true and false and false or true
True
? true and false and true or false
False

I believe it evaluates from left to right, to in the first case

True and False is False then

False and false = False

then
false or true = True
so true is the result

in the second case

True and false = False
False and true = False
False or False = False

Probably need to be specific

If (UCase(z(i, 1)) < "CS" And UCase(z(i, 1)) < "") And
(UCase(.Cells(intPos,
8)) = "CS" Or UCase(.Cells(intPos, 8))) = "" Then



or whatever you intent is.

--
Regards,
Tom Ogilvy



"AD108" wrote in message
...
I can't figure out why the following expression is evaluating to True when
UCase(z(i, 1)) is equal to ""
What am I missing here. Thanks in advance for any help.

If UCase(z(i, 1)) < "CS" And UCase(z(i, 1)) < "" And
UCase(.Cells(intPos, 8)) = "CS" Or UCase(.Cells(intPos, 8)) = "" Then






AD108

Going nuts on this one...
 
Thanks very much Tom,

Much appreciated. I was able to work this out eventually, but I had to
rearrange the structure of all the logic.




"Tom Ogilvy" wrote in message
...
? true and false and false or true
True
? true and false and true or false
False

I believe it evaluates from left to right, to in the first case

True and False is False then

False and false = False

then
false or true = True
so true is the result

in the second case

True and false = False
False and true = False
False or False = False

Probably need to be specific

If (UCase(z(i, 1)) < "CS" And UCase(z(i, 1)) < "") And
(UCase(.Cells(intPos,
8)) = "CS" Or UCase(.Cells(intPos, 8))) = "" Then



or whatever you intent is.

--
Regards,
Tom Ogilvy



"AD108" wrote in message
...
I can't figure out why the following expression is evaluating to True when
UCase(z(i, 1)) is equal to ""
What am I missing here. Thanks in advance for any help.

If UCase(z(i, 1)) < "CS" And UCase(z(i, 1)) < "" And
UCase(.Cells(intPos, 8)) = "CS" Or UCase(.Cells(intPos, 8)) = "" Then









All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com