VBA Comparison Operator
VBA Comparison Operator

Comparison operators can be used to compare numbers or strings and perform evaluations. Expressions using comparison operators do not return a number value, as do arithmetic expressions. Comparison expressions return either 1, which is true, or 0, which is false. Some comparison operators include equal to, less than, greater than, and not equal to.

In VBA, compression operators include less than (<), greater than (>), equal to (=), less than equal to (<=), greater than equal to (>=), and not equal to (<>).

The following examples show the comparison operators defined for VBA

1. Equal Sign (=)

This operator sign can be used to find out whether one thing is equal to another. The result will be TRUE or FALSE. If one thing is greater than another, then TRUE is produced, and False is produced.

Example:


2. Not Equal to (<>)

Not equal to operator is used to check if two values are not equal. If one thing is equal to another. If one thing is equal to another, it returns FALSE or TRUE.

Example:


3. Greater Than (>)

This symbol determines whether one number is greater than the other, and is also a logical VBA operator with a return of either TRUE or FALSE.

Example:


4. Greater Than Equal to (> =)

The greater than equal to operator is used to check if the first value is greater than or equal to the second value and returns True or False.

Example:


5. Less Than ( < )

This sign checks whether one number is less than the other number. It is also a logical operator in VBA, where the result is either TRUE or FALSE.

Example:


6. Less than equal to ( < = )

Less than equal operator is used to checking if the value that comes first is less than or equal to the second value and returns True or False.

Example: