Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/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
找到一个真实的?在excelvba中_Vba_Excel - Fatal编程技术网

找到一个真实的?在excelvba中

找到一个真实的?在excelvba中,vba,excel,Vba,Excel,我需要找一个真实的?在一系列的细胞中。我正在使用以下代码: Dim rCell As Range Dim rArea As Range ' set range variable = Column in the active sheet. Set rCell = Range("g1") Set rArea = Range("g2:g" & countusers) For Each rCell In rArea With rCell

我需要找一个真实的?在一系列的细胞中。我正在使用以下代码:

    Dim rCell As Range
    Dim rArea As Range

' set range variable = Column in the active sheet.
    Set rCell = Range("g1")
    Set rArea = Range("g2:g" & countusers)
    For Each rCell In rArea
    With rCell
    Dim Qmark As Integer
        If InStr(1, (rCell.Value), "~?") > 0 Then
       MsgBox "Cell " & rCell.Address & "has a question mark in it"
        Qmark = Qmark + 1
        End If
我把~放在问号前面,但它不起作用。
提前谢谢

我弄明白了。我补充说:

Dim SearchChar as String
SearchChar = "?"

然后将InStr行中的“~?”替换为SearchChar,它就起作用了

InStr
方法不需要tilde
~
,所以只需删除它即可。只有在使用
Range.Find方法时才需要波浪线