• Ceiling Function (VB6)

    Author
    Topic
    #390071

    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

    Viewing 0 reply threads
    Author
    Replies
    • #691449

      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

    Viewing 0 reply threads
    Reply To: Ceiling Function (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: