Vba Programming Basics


Comparison Operators The following table lists comparison operators:

You use comparison operators between two expressions to determine if the expressions are equal, greater than, or less than each other.

VBA uses these operators to compare numerical or string values. If comparison operators compare a numerical and string value, Excel always evaluates the numeric expression as less than the string expression.

If you compare two string expressions, Excel looks at the characters in the string and not the string length to determine which string is longer. For example, if you compare abcd with cd, Excel considers cd to be greater because the letter c comes after a. This is true even though it has fewer characters.

0 0

Post a comment