VBA/Excel/Access/Word/Data Type/Byte — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 19:33, 26 мая 2010
Attempts to store the numbers 52 and 5.2 in a variable declared as type Byte.
<source lang="vb">
Sub ByteDemo()
Dim myVar As Byte myVar = 52 Debug.Print myVar myVar = 5.2 Debug.Print myVar
End Sub
</source>
You should also be careful about mixing numerical data types in mathematical operations
<source lang="vb">
Sub Mix()
Dim myAnswer As Byte Dim num1 As Single Dim num2 As Byte num1 = 4.1 num2 = 5 myAnswer = num1 * num2
End Sub
</source>