Vba-comparison-operators
提供:Dev Guides
VBA-比較演算子
VBAでサポートされている比較演算子は次のとおりです。
変数Aが10を保持し、変数Bが20を保持すると仮定します-
Operator | Description | Example |
---|---|---|
= | Checks if the value of the two operands are equal or not. If yes, then the condition is true. | (A = B) is False. |
<> | Checks if the value of the two operands are equal or not. If the values are not equal, then the condition is true. | (A <> B) is True. |
> | Checks if the value of the left operand is greater than the value of the right operand. If yes, then the condition is true. | (A > B) is False. |
< | Checks if the value of the left operand is less than the value of the right operand. If yes, then the condition is true. | (A < B) is True. |
>= | Checks if the value of the left operand is greater than or equal to the value of the right operand. If yes, then the condition is true. | (A >= B) is False. |
⇐ | Checks if the value of the left operand is less than or equal to the value of the right operand. If yes, then the condition is true. | (A ⇐ B) is True. |
例
VBAで使用可能なすべての比較演算子を理解するには、次の例を試してください。
上記のスクリプトを実行すると、次の結果が生成されます。