|
- Public Function RoundToLarger(dblInput As Double, intDecimals As Integer) As Double
-
- 'Implements a variant of the Round() function, that rounds-to-larger
- 'rather than rounds-to-even:
-
- Dim strFormatString As String 'Format string
-
- 'If input is zero, just return zero. Else format as appropriate:
- If dblInput <> 0 Then
- strFormatString = "#." & String(intDecimals, "#")
- RoundToLarger = Format(dblInput, strFormatString)
- Else
- RoundToLarger = 0
- End If
-
- End Function
复制代码 转自: http://www.tek-tips.com/faqs.cfm?spid=705&rat1=10&sfid=3734- ? Round(2.385, 2)
- 2.38
- ? RoundToLarger(2.385, 2)
- 2.39
复制代码 |
|