Results 1 to 4 of 4

Thread: rounding

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 1999
    Location
    St. Louis MO USA
    Posts
    18

    Post

    In C++ there is a ceiling function that allows one to always round a number up. Example: if the number is 11.1 ceiling will round to 12. I know about Round(number,0) and Format(number,"###.") , but these will round a number less that .5 down to the next lowest integer. Is there some sort of ceiling function in VB

    ------------------

  2. #2
    Guest

    Post

    Try this code:-

    Private Sub rounder(ByVal number As Double)
    Dim place As Integer
    If InStr(number, ".") <> 0 Then
    place = InStr(number, ".")
    number = Left(number, place)
    number = number + 1
    MsgBox number
    Else
    End If


    Glenn Harwood
    End Sub

  3. #3
    Guest

    Post

    Sorry, slight typo...try this

    Try this code:-

    Private Sub rounder(ByVal number As Double)
    Dim place As Integer
    If InStr(number, ".") <> 0 Then
    place = InStr(number, ".")
    number = Left(number, place)
    number = number + 1
    MsgBox number
    Else
    End If
    End Sub

    Glenn Harwood

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Is it not too much of coding for this?

    Why don't you just + 0.5 to the number to be rounded?

    Looks shorter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width