Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 -- turnerje ------------------------------------------------------------------------ turnerje's Profile: http://www.excelforum.com/member.php...o&userid=25694 View this thread: http://www.excelforum.com/showthread...hreadid=474906 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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") -- Don Guillett SalesAid Software "turnerje" wrote in message ... 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 -- turnerje ------------------------------------------------------------------------ turnerje's Profile: http://www.excelforum.com/member.php...o&userid=25694 View this thread: http://www.excelforum.com/showthread...hreadid=474906 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- Gary "turnerje" wrote in message ... 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 -- turnerje ------------------------------------------------------------------------ turnerje's Profile: http://www.excelforum.com/member.php...o&userid=25694 View this thread: http://www.excelforum.com/showthread...hreadid=474906 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
Simple Simple Excel usage question | Excel Discussion (Misc queries) | |||
Simple VBA question | Excel Programming | |||
simple question? | New Users to Excel | |||
simple question, hopefully a simple answer! | Excel Programming |