Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jul 2001
    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????


  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator
    Join Date
    Dec 2000
    Salt Lake City, Utah, USA
    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