[英]How do I search through a Range of cells in VBA for excel for values that are a strings not equal to “phrase”
我被要求在VBA中编写一个足够简单的任务,我通常使用Java,甚至从未研究过VBA。 我用谷歌搜索时并没有真正得到想要的东西,所以我想在这里问。
如何在VBA的单元格范围中搜索excel,以获取不等于“短语”的字符串值
对于看起来如此简单的问题,我们深表歉意,但这不是我的专长,非常感谢您提供任何反馈意见
马丁
请看下面。 您可以相应地更改范围
Sub searchfor()
Dim rng As Range
Set rng = Range("A1:B100") ' Identify your range
For Each c In rng.Cells
If c.Value <> "" And c.Value <> "phrase" Then '<--- Will search if the cell is not empty and not equal to phrase. If you want to check empty cells too remove c.value <> ""
MsgBox (c.Address & "Not Equal") '<---- Your code goes here
End If
Next c
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.