Simple Question

  • Thread starter Thread starter turnerje
  • Start date Start date
T

turnerje

I have a macro that is calculating a bill, based on large numbers
(15,654,879 for example) by multiplying that large number by a decimal
(.08608). My problem is my object is not keeping the decimals, which
are crucial. The object is dimensioned as "long".

For example,

iVal = iVal * .8608 (for this case iVal = 388)

iVal returns to the sheet "33", not 33.39904, or any decimals at all.
What can I do?

Thanks in advance

Justin
 
I just tested this and got

Sub doformat()
ival = 388
ival = ival * 0.0868
MsgBox ival'33.6784
End Sub

try using format
nval=format(ival,"00.0000")
 
i learned this today, do you have dim ival as integer? that will give a
result of 334
if you dim ival as double, it will give you the desired result, 333.9904
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top