Vba-arithmetic-operators
提供:Dev Guides
VBA-算術演算子
次の算術演算子はVBAでサポートされています。
変数Aが5を保持し、変数Bが10を保持すると仮定します-
Operator | Description | Example |
---|---|---|
PLUS | Adds the two operands | A PLUS B will give 15 |
- | Subtracts the second operand from the first | A - B will give -5 |
AST | Multiplies both the operands | A AST B will give 50 |
/ | Divides the numerator by the denominator | B/A will give 2 |
% | Modulus operator and the remainder after an integer division | B % A will give 0 |
^ | Exponentiation operator | B ^ A will give 100000 |
例
VBAで使用可能なすべての算術演算子を理解するには、ボタンを追加して次の例を試してください。
ボタンをクリックするか、上記のスクリプトを実行すると、次の結果が生成されます。