Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 如何在VBA for excel中的一系列单元格中搜索不等于“0”的字符串值;短语;_String_Vba_Excel_Find - Fatal编程技术网

String 如何在VBA for excel中的一系列单元格中搜索不等于“0”的字符串值;短语;

String 如何在VBA for excel中的一系列单元格中搜索不等于“0”的字符串值;短语;,string,vba,excel,find,String,Vba,Excel,Find,我被要求用VBA编写一个足够简单的任务,我通常使用Java,甚至从来没有看过VBA。当我在谷歌上搜索时,我并没有真正得到我想要的,所以我想我应该在这里问一下 如何在VBA for excel中的一系列单元格中搜索不等于“短语”的字符串值 很抱歉,这似乎是一个简单的问题,但这不是我的领域,任何反馈都非常感谢 马丁请看下面。您可以相应地更改您的范围 Sub searchfor() Dim rng As Range Set rng = Range("A1:B100") ' Identify your

我被要求用VBA编写一个足够简单的任务,我通常使用Java,甚至从来没有看过VBA。当我在谷歌上搜索时,我并没有真正得到我想要的,所以我想我应该在这里问一下

如何在VBA for 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
子搜索()
变暗rng As范围
设置rng=范围(“A1:B100”)'识别您的范围
对于每个c In rng.单元格

如果c.Value和c.Value的短语“那么”很有效!这正是我要找的,就这么简单,谢谢!