Excel VBA在对比字符串的时候不区分大小写的语句(实测可用)

代码如下
Option Compare Text '以文本方式比较,不区分大小写(此语句必须写在所有过程之前,不可以在Sub中定义,否则报错)
Sub Test()
Dim T1 As String, T2 As String, T3 As String
T1 = "Yuanzifan.com"
T2 = "YuanZIFAN.COm"
T3 = "YuAnZiFaN.CoM"
If T1 Like T2 = True Then MsgBox "True" '使用like而不是“=”
If T2 Like T3 = True Then MsgBox "True"
If T2 Like T3 = True Then MsgBox "True"
End Sub 文章源自原紫番博客-https://www.yuanzifan.com/1316.html

站长微信
扫码添加(注明来意)
weinxin
Yuanzifan99
原梓番博客公众号
博客内容精选
weinxin
原梓番博客
 最后更新:2013-12-10

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证