Excel 2013 VBA像条件冒号不会工作
gettxt ='ATCH 6:第2页(共2页)的值
gettxt值来自文本格式的单元格。
我不能得到以下的条件是真实的。
如果LCase(gettxt)像“* atch#*:”那么…
有关如何解决Like语句的build议表示赞赏。
冒号后面只剩下一个“*”。 你的条件规定冒号后不应该有任何东西,但是你的“gettxt”值在其后面有内容。 所以正确的条件应该是:
If LCase(gettxt) Like "*atch #*:*" Then
完整的工作版本:
Sub test() gettxt = "ATCH 6: Page 2 of 2" If LCase(gettxt) Like "*atch #:*" Then Debug.Print "Working!" Else Debug.Print "Not Working!" End If End Sub
希望这可以帮助!