Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Ceiling Function (VB6)

    Hello all

    I am programming in vb6 and require the use of ceiling(myvar,0.25). This works in excel perfectly but now need a similar function to work in vb6. When I type it in, vb does not recognize it. How can I make this work????

    Thanks

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,507
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Ceiling Function (VB6)

    This should do it, but please test to your own satisfaction:

    Public Function vfCeiling(dblValIn As Double, dblCeilIn As Double) As Double
    ' round it
    vfCeiling = Round(dblValIn / dblCeilIn, 0) * dblCeilIn
    ' if it rounded down, force it up
    If vfCeiling < dblValIn Then vfCeiling = vfCeiling + dblCeilIn
    End Function
    -John ... I float in liquid gardens
    [acronym title="Gday mate!"][/acronym] [acronym title="What up Dude?"][/acronym] UTC -7±DS

Posting Permissions

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