The best Visual Basic FAQ(Frequently Asked Quesitions) file on the internet.
Do you have a problem that's got you stumped? Do you have the answer to one? We've done our best to make
this the best resources for the questions and the answers. Post a question, or a answer
to one, by sending email to VBQA@beadsandbaubles.com.
I process customer orders, and they come
in batches of tens. I need to round a number to the closest
10, but I can only round up. Otherwise,
the user won't have sufficent product. How can I do this? Plus, is there anyway to round down?
Function RoundUp(byVal Value as long, Round as long)
RoundUp = ((Value \ Round) + Sgn(Value Mod Round)) * 5
End Function
Function RoundDown(byVal Value as long, Round as long)
RoundUp = Value - (Value mod Round)
End Function