Sub Main()
Dim num1 As Integer
Dim num2 As Single
Dim str1 As String
Dim str2 As String
Dim obj1 As Object
Dim obj2 As Object
Dim result As Boolean
num1 = 10
num2 = 10
str1 = "10"
str2 = "ABC"
Set obj1 = Range("A1")
Set obj2 = Range("A1")
result = (num1 = num2) 'result holds True
result = (num1 < num2) 'result holds False
result = (num1 > num2) 'result holds False
result = (num1 >= num2) 'result holds True
result = (num1 <= num2) 'result holds True
result = (num1 <> num2) 'result holds False
result = (num1 = str1) 'result holds True
' result = (num1 = str2) 'Type mismatch error
result = (str1 = str2) 'result holds False
result = (str1 > str2) 'result holds False
result = (str1 < str2) 'result holds True
result = ("a" < "A") 'result holds False
result = (str1 >= str2) 'result holds False
result = (str1 <= str2) 'result holds True
result = (str1 <> str2) 'result holds True
result = (obj1 Is obj2) 'result holds False
Set obj1 = obj2
result = (obj1 Is obj2) 'result holds True
End Sub
|