I was look at some code that I thought should produce a type mismatch but it didn't. A simulation of that code is:
This produces "X > Y" in the immediate window even though Y is at the maximum value for a double. This makes me wonder how VBA is evaluating this internally. Does anyone know what's going on here?
PS: Debug.Print VarType(X) produces 8 which is a string type.
Code:
Private Sub WhatsUp()
Dim X As Variant
Dim Y As Double
X = "A"
Debug.Print VarType(X)
Y = 1.79769313486231E+308
If X > Y Then
Debug.Print "X > Y"
Else
Debug.Print "X <= Y "
End If
End Sub
This produces "X > Y" in the immediate window even though Y is at the maximum value for a double. This makes me wonder how VBA is evaluating this internally. Does anyone know what's going on here?
PS: Debug.Print VarType(X) produces 8 which is a string type.