鉴于Empty = 0的变体,正在寻找是否有人可以区分两者,就像下面的虚拟函数一样
Function doGetFmt(v As Variant) As String
dim s as String
If IsEmpty(v) Then s ="Empty"
If v=0 s= "zero"
doGetFmt = s
End Function
答案 0 :(得分:0)
根据GSerg的评论:
Dim v As Variant
Debug.Print IsEmpty(v) '>> #true#
Debug.Print v = 0 '>> true
v = 0
Debug.Print IsEmpty(v) '>> #false#
Debug.Print v = 0 '>> true
如果IsEmpty()
返回false时仅测试零,那么您将更接近所需的内容。