Thread: Ceiling Function (VB6)
2003-07-06, 02:39 #1
- Join Date
- Jul 2001
- Thanked 0 Times in 0 Posts
Ceiling Function (VB6)
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????
Subscribe to our Windows Secrets Newsletter - It's Free!
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!
+ 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!
2003-07-06, 04:12 #2
- 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