|
-
May 15th, 2007, 02:06 PM
#1
Thread Starter
New Member
Automatic rounding up of number?
hi first time here, i am making a program to calculate postage costs. and on a loop that is in the program when it does the sum of 3.45 + 0.86 it comes up with 4.30 when it should be 4.31
The loop Code:
Dim extracost As Currency
Dim loopcost As Currency
Dim extracostformated As Currency
Dim loopcostformated As Currency
loopcost = 3.45
extracost = 0.86
loopcostformated = FormatNumber(loopcost, 2)
extracostformated = FormatNumber(extracost, 2)
Cost = loopcostformated And Weight = Weight - 1000
Do While Weight > 0
Weight = Weight - 250
Cost = Cost + extracostformated
Loop
Last edited by joshbro90; May 15th, 2007 at 02:13 PM.
-
May 15th, 2007, 03:38 PM
#2
Re: Automatic rounding up of number?
Hi, welcome to the forums!
You may have more luck with this question if you post it in the Classic VB forum.
-
May 15th, 2007, 08:48 PM
#3
Addicted Member
Re: Automatic rounding up of number?
i believe formatNumber is used only for outputting a string representation of the number, so try formatNumber on the result, not the numbers used for the calculations
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|