From: MarkJ on
There's a Microsoft KnowledgeBase article with a big list of rounding
functions.

SymUp rounds fractions up (away from zero)

Function SymUp(ByVal X As Double, _
Optional ByVal Factor As Double = 1) As Double
Dim Temp As Double
Temp = Fix(X * Factor)
SymUp = (Temp + IIf(X = Temp, 0, Sgn(X))) / Factor
End Function

Full list here
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q196652
From: Rick Raisley on
"Dee Earley" <dee.earley(a)icode.co.uk> wrote in message
news:eSQxYKItKHA.3536(a)TK2MSFTNGP06.phx.gbl...
> On 23/02/2010 11:37, hermann leinen wrote:
>> Hello,
>>
>> I want to calculate how many rows I need in a grid for a given number of
>> cells when the number of columns is limited to let's say 6.
>> Somehow I don't find any better way than using Mod because
>>
>> lCellCount=1917
>> lMaxCols = 6
>>
>> would return 319,5
>> but VB6 rounds that down to 319 instead of rounding it up.
>> This means I get 1 row less than I really need.
>
> It CInt() will round to the nearest even number, Int() will truncate.
>
>> I was only able to help me by using Mod but that looks fishy/ unncessary
>> to me.
>
> This will always round up to the next integer.
> If Rows > Int(Rows) then Rows = Int(Rows) + 1
>

As will this, which is a bit quicker:

lRows = - Int(-lCellCount / lMaxCols)

--
Regards,

Rick Raisley
heavymetal-A-T-bellsouth-D-O-T-net