Not operator
Used to perform logical negation on an expression.
Syntax
result = Not expression
The Not operator syntax has these parts:
Part | Description |
---|---|
result | Required; any numeric variable. |
expression | Required; any expression. |
Remarks
The following table illustrates how result is determined.
If expression is | Then result is |
---|---|
True | False |
False | True |
Null | Null |
In addition, the Not operator inverts the bit values of any variable and sets the corresponding bit in result according to the following table.
If bit in expression is | Then bit in result is |
---|---|
0 | 1 |
1 | 0 |
Example
This example uses the Not operator to perform logical negation on an expression.
Dim A, B, C, D, MyCheck
A = 10: B = 8: C = 6: D = Null ' Initialize variables.
MyCheck = Not(A > B) ' Returns False.
MyCheck = Not(B > A) ' Returns True.
MyCheck = Not(C > D) ' Returns Null.
MyCheck = Not A ' Returns -11 (bitwise comparison).
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기