User Tools

Site Tools


vba:functions:ceil

[VBA] ceil()

Liefert die nächste ganze Zahl, die größer oder gleich dem Inputparameter ist.

Download udf_ceil.bas

Definition

double = ceil(zahl)
Public Function ceil(ByVal iValue As Variant) As Double
  • iValue Wert, der aufgerundet werden soll

Beispiele

?ceil(17.512)
 18 
 
?ceil(17.009)
 18 

Code

udf_ceil
'-------------------------------------------------------------------------------
'File         : udf_ceil.bas
'               Copyright mpl by ERB software
'               All rights reserved
'               http://wiki.yaslaw.info/dokuwiki/doku.php/vba/functions/concat
'Environment  : VBA 2010 +
'Version      : 1.0.0
'Name         : ceil
'Author       : Stefan Erb (ERS)
'History      : 16.06.2014 - ERS - Creation
'-------------------------------------------------------------------------------
Option Explicit
 
'/**
' * Rundet eine Zahl auf. Das gegenteil von fix()
' *
' *     double = ceil(zahl)
' *
' * @param  Variant
' * @return Double
' */
Public Function ceil(ByVal iValue As Variant) As Double
    ceil = Fix(iValue + 0.9999999999)
End Function
vba/functions/ceil.txt · Last modified: 15.09.2014 11:35:58 by yaslaw