Seke,
Basically what you need to do is use the MOD operator to test your ActualMinutes and see if they are evenly divisible by 6. The MOD operator returns only the Remainder of a division operation.
Thus if your ActualMinutes are 12, 12 MOD 6 = 0, and your
ActualMinutes are evenly divisible by 6 and your Billing Minutes = your ActualMinutes.
If, however, your ActualMinutes are 13, 13 MOD 6 = .16666666 (which is > 0), so your ActualMinutes are not evenly divisible by 6, and your Billing Minutes <> your ActualMinutes.
In this case you must then increment your ActualMinutes by 1
(ActualMinutes = ActualMinutes + 1) and run the test again.
You repeat this proceedure until ActualMinutes MOD 6 = 0, and then your Billing Minutes = your ActualMinutes. You then exit the proceedure.
I haven't tested this sub, but I'm pretty sure the syntax is correct.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Sub CalculateBillingTime()
Dim ActualMinutes As Integer
Dim BillingMinutes As Integer
Test1:
If ActualMinutes MOD 6 = 0 Then 'AMinutes divisible by 6
BillingMinutes = ActualMinutes
Goto LeaveFunction
End If
Test2:
If ActualMinutes MOD 6 > 0 Then 'Problem not solved yet
ActualMinutes = ActualMinutes +1
Goto Test1
End If
LeaveFunction:
'Problem solved, now exit the Sub now
End Sub
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I know it's complicated, but that's what you get for charging people for more work or calling time than you're actually delivering! LOL!
Hope this points you in the right direction. Check the syntax carefully (I've been up 28 hours and am feeling a little fuzzy!)
The Missinglinq
"It's got to be the going,
not the getting there that's good!"
-Harry Chapin