![]() In conclusion, as both variables are equal to 5, the blnResult returns True: We use the > = operator in the If statement to check if the value of intA is greater than or equal to intB: If intA >= intB Then If this is true, the value of Boolean blnResult will be True, otherwise, it will be False. In this example, we want to check if intA is greater than or equal to intB. Less Than or Equal To MsgBox 5 = intB Then If this is true, the value of Boolean blnResult will be True, otherwise, it will be False.įirst, we set values of intA and intB to 5: intA = 5Īfter that, we use the = operator in the If statement to check if the values of intA and intB are equal: If intA = intB Thenīoth variables are equal to 5, therefore the blnResult returns True: In this example, we want to check if intA is equal to intB. It checks if two values are equal and returns True or False. ![]() The Equal to operator works exactly the same. The value of intA is 5 and the value of intB is 6, the variables are not equal, therefore the blnResult returns True: We use the operator in the If Statement to check if the values of intA and intB are different: If intA intB Then If this is true, the value of Boolean variable blnResult will be True, otherwise, it will be False. In this example, we want check if Integer Variable intA is not equal to intB. This example will test if two cell values are not equal to each other: MsgBox Range("A1").Value Range("B1").valueĪnother way to compare values is with Variables. Let’s demonstrate two other ways to compare values. In the previous example, we hard-coded 5 and 3 into our code. There are several ways you might compare numbers.
0 Comments
Leave a Reply. |