Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.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
Excel VBA StrCmp子项或函数未定义_Excel_Excel 2007_Strcmp_Vba - Fatal编程技术网

Excel VBA StrCmp子项或函数未定义

Excel VBA StrCmp子项或函数未定义,excel,excel-2007,strcmp,vba,Excel,Excel 2007,Strcmp,Vba,我试图在excel vba(使用excel 2007)中使用StrCmp函数,但出现以下错误: 编译错误: 未定义子或函数 这是我的密码: StrCmp(Worksheets(1).Range("I" & x).Value, "Critical") 任何帮助都将不胜感激。函数名为StrComp,您可以说: StrComp(StringArg1、StringArg2、compareMethod)=0表示匹配。 在您的情况下,您似乎会使用 if StrComp(Cstr(Works

我试图在excel vba(使用excel 2007)中使用StrCmp函数,但出现以下错误: 编译错误: 未定义子或函数

这是我的密码:

    StrCmp(Worksheets(1).Range("I" & x).Value, "Critical")

任何帮助都将不胜感激。

函数名为
StrComp
,您可以说:
StrComp(StringArg1、StringArg2、compareMethod)=0
表示匹配。
在您的情况下,您似乎会使用

if StrComp(Cstr(Worksheets(1).Range("I" & x).Value), "Critical", vbTextCompare) = 0 then
    ' you now have found a match
    ' do something
end if
更多关于,也可以在这里看到