Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel question with variable definition
Hi,
I have a macro running on Excel 2003. I simply read a value from a cell using macro in which the value is defined as single, double, or even variant, then write the value on another cell. Now the number has some left over values. For instance, 100.1 becomes 100.099998474121. If the original number is an integer, then it is ok. However, any decimal number resulted in a different number though there is about 0.1% difference. Is there something I am doing wrong, or is this a bug? Any help would be appreciated. -- Yong Kim |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel question with variable definition
This is a 'bug' in Excel. For a full description, see the website below.
The website specifically goes through Excel 97 but the same is true of Excel 2003. http://www.cpearson.com/excel/rounding.htm To solve your problem, use the round() function. HTH, Gary Brown "Yong Kim" wrote: Hi, I have a macro running on Excel 2003. I simply read a value from a cell using macro in which the value is defined as single, double, or even variant, then write the value on another cell. Now the number has some left over values. For instance, 100.1 becomes 100.099998474121. If the original number is an integer, then it is ok. However, any decimal number resulted in a different number though there is about 0.1% difference. Is there something I am doing wrong, or is this a bug? Any help would be appreciated. -- Yong Kim |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel question with variable definition
Thanks very much. It helped me to understand the problem. I really appreciate
your support. "Gary Brown" wrote: This is a 'bug' in Excel. For a full description, see the website below. The website specifically goes through Excel 97 but the same is true of Excel 2003. http://www.cpearson.com/excel/rounding.htm To solve your problem, use the round() function. HTH, Gary Brown "Yong Kim" wrote: Hi, I have a macro running on Excel 2003. I simply read a value from a cell using macro in which the value is defined as single, double, or even variant, then write the value on another cell. Now the number has some left over values. For instance, 100.1 becomes 100.099998474121. If the original number is an integer, then it is ok. However, any decimal number resulted in a different number though there is about 0.1% difference. Is there something I am doing wrong, or is this a bug? Any help would be appreciated. -- Yong Kim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA variable definition help needed. | New Users to Excel | |||
[variable] definition | Excel Programming | |||
variable range definition | Excel Programming | |||
question on the definition of refer to | Excel Programming | |||
Problem Using an Object Variable in a Class Definition | Excel Programming |