Problem with logical sentence
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" Then ..... end if however, the conditions are ignored when the program is running... why -- Message posted from http://www.ExcelForum.com |
Problem with logical sentence
Cecilia,
I think you want ANDs instead of ORs. With ANDs, one of the < conditions will always be true, regardless of the value of Cells(NumFilas,2). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "cecilia12345" wrote in message ... i have this conditional sentence If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" Then .... end if however, the conditions are ignored when the program is running... why? --- Message posted from http://www.ExcelForum.com/ |
Problem with logical sentence
Have you tried bracketing the equations? Might work..
eg. If ((Cells(NumFilas, 2).Value < "NAFF") Or (Cells(NumFilas, 2).Value < "NEQ") _ Or (Cells(NumFilas, 2).Value < "IBR")) Then John "cecilia12345" wrote in message ... i have this conditional sentence If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" Then .... end if however, the conditions are ignored when the program is running... why? --- Message posted from http://www.ExcelForum.com/ |
Problem with logical sentence
Because you should be using And <<grin.
-- Regards Brian "cecilia12345" wrote in message ... i have this conditional sentence If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" Then .... end if however, the conditions are ignored when the program is running... why? --- Message posted from http://www.ExcelForum.com/ |
Problem with logical sentence
I think you want ANDs instead of ORs. With ANDs, one of the <
I meant With ANDs not ORs. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chip Pearson" wrote in message ... Cecilia, I think you want ANDs instead of ORs. With ANDs, one of the < conditions will always be true, regardless of the value of Cells(NumFilas,2). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "cecilia12345" wrote in message ... i have this conditional sentence If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" Then .... end if however, the conditions are ignored when the program is running... why? --- Message posted from http://www.ExcelForum.com/ |
Problem with logical sentence
|
Problem with logical sentence
-----Original Message----- i have this conditional sentence If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" Then ..... end if however, the conditions are ignored when the program is running... why? --- Message posted from http://www.ExcelForum.com/ . Try sometihng like this MyCheck = Cells(NumFilas, 2).Value < "NAFF" Or Cells (NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" If MyCheck = True then... ' ome Else... End If |
Problem with logical sentence
At least two of the conditions will always be true. Change your OR to AND I
think. -- Regards, Tom Ogilvy cecilia12345 wrote in message ... i have this conditional sentence If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" Then .... end if however, the conditions are ignored when the program is running... why? --- Message posted from http://www.ExcelForum.com/ |
Problem with logical sentence
Chip,
Want to try again? <bg Ryan -----Original Message----- I think you want ANDs instead of ORs. With ANDs, one of the < I meant With ANDs not ORs. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chip Pearson" wrote in message ... Cecilia, I think you want ANDs instead of ORs. With ANDs, one of the < conditions will always be true, regardless of the value of Cells(NumFilas,2). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "cecilia12345" <cecilia12345.yjxtb@excelforum- nospam.com wrote in message news:cecilia12345.yjxtb@excelforum- nospam.com... i have this conditional sentence If Cells(NumFilas, 2).Value < "NAFF" Or Cells (NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value < "IBR" Then .... end if however, the conditions are ignored when the program is running... why? --- Message posted from http://www.ExcelForum.com/ . |
All times are GMT +1. The time now is 09:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com