Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.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
部分单元格匹配和忽略标点VBA_Vba_Excel_Punctuation - Fatal编程技术网

部分单元格匹配和忽略标点VBA

部分单元格匹配和忽略标点VBA,vba,excel,punctuation,Vba,Excel,Punctuation,这是我们的延伸问题 如果名字中有标点符号,我想知道如何进一步改进John Coleman提供的以下代码 Name1的一个例子是“IT主管Sally,Lim” Name2的一个例子是“Sally,Lim” 使用函数“整理”字符串: Function ReplacePunct(strInput As String) As String chars = Array(".", ",", ";", ":") '// Change as required For Each ch In chars

这是我们的延伸问题

如果名字中有标点符号,我想知道如何进一步改进John Coleman提供的以下代码

Name1的一个例子是“IT主管Sally,Lim”

Name2的一个例子是“Sally,Lim”

使用函数“整理”字符串:

Function ReplacePunct(strInput As String) As String

chars = Array(".", ",", ";", ":") '// Change as required

    For Each ch In chars
        While InStr(strInput)
            strInput = Replace(strInput, CStr(ch), vbNullString)
        Wend
    End If

End Function
然后像这样使用它:

If UCase(Trim(ReplacePunct(Name1))) Like "*" & UCase(Trim(ReplacePunct(Name2))) & "*" then
If UCase(Trim(ReplacePunct(Name1))) Like "*" & UCase(Trim(ReplacePunct(Name2))) & "*" then