VBA/Excel/Access/Word/Math Functions/Fix

Материал из VB Эксперт
Версия от 15:46, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Displaying the integer part of a number: uses the Fix function, which returns the integer portion of a value - the value without any decimal digits

   <source lang="vb">

Sub GetIntegerPart()

   Dim MyValue As Double
   Dim IntValue As Integer
   MyValue = 123.456
   IntValue = Fix(MyValue)
   MsgBox IntValue

End Sub

</source>
   
  


Fix(- returns -3

   <source lang="vb">

Sub mathDemo6()

  Debug.Print Fix(-3.14159)

End Sub

</source>
   
  


Fix(number) returns The integer portion of number (without rounding). If number is negative, returns the negative number greater than or equal to number.

   <source lang="vb">

Sub mathDemo5()

  Debug.Print Fix(3.14159)

End Sub

</source>
   
  


Fix() Returns the integer portion of a number.

   <source lang="vb">

Sub mathF3()

   Debug.Print Fix(-9.1)

End Sub

</source>