PDA

View Full Version : Solved: Calculate Number of pages



Dr.K
07-12-2010, 06:54 AM
My current code feels a little awkward.... I need to put three funds per page into a report. Is there a simpler way to do this?


'calculate pages
If intFunds < 4 Then
'One page
intPages = 1
Else
' Multiple Pages
If (intFunds Mod 3) = 0 Then
intPages = Int(intFunds / 3)
Else
intPages = Int(intFunds / 3) + 1
End If
End If

p45cal
07-12-2010, 05:49 PM
try just one line:

intpages = Application.Ceiling(intfunds / 3, 1)

Dr.K
07-13-2010, 08:37 AM
try just one line:

Ahah! I should have thought to check the Worksheet Functions.

Thank you very much, that is perfect.