如果逻辑满足两个条件之一 [英] If logic where either of two conditions make it true
本文介绍了如果逻辑满足两个条件之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果V列中的单元格不等于F或V,我试图删除一行.
I am trying to delete a row if cells in column V is not equal to F or V.
此代码将删除所有内容.
This code deletes everything.
For i = RowCount To 1 Step -1
If Range("V" & i).Value <> "F" Or Range("V" & i).Value <> "V" Then Rows(i).Delete
Next i
推荐答案
您的逻辑似乎不正确.通过将或更改为
and
,您将可以评估适当的布尔算术.
Your logic seems incorrect. By changing the or
to an and
, you will then be evaluating the proper boolean arithmetic.
现在,您要检查的 not"v"
和 not"f"
始终为假.无论输入什么,答案总是正确的.
Right now, you are checking not "v"
and not "f"
which is always false.
No matter the input, this will always have answer be true.
这篇关于如果逻辑满足两个条件之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文