CedricMattelaer
New Member
- Joined
- Jun 16, 2011
- Messages
- 37
Hello all,
This is a follow-up on a previous question (http://www.mrexcel.com/forum/showthread.php?p=2935323#post2935323), as I just now found out what seems to be causing the problem, I prefer to post it in a specific thread.
I have a formula which simplified (without loops and variables) goes as follows:
I want to add a specific value to the value already in that cell, and prefer to keep them written as a sum.
Now, sometimes the evaluation of this code results in an error. After long debugging, I found out that this happens in cells for which .Cells(592, 22) contains a lot of decimals (for example 0,999999999996).
If I change this number to 1, the program does what it should do without any problem.
I tried to set the decimal designator to . instead of a comma (",") but that doesn't make any difference.
Of course, I can first replace each cell by its rounded equivalent, but that's not very effective...
Is it normal that this happens? What is it due to? Is there any way around it?
If anyone has any clues, thanks for sharing!
This is a follow-up on a previous question (http://www.mrexcel.com/forum/showthread.php?p=2935323#post2935323), as I just now found out what seems to be causing the problem, I prefer to post it in a specific thread.
I have a formula which simplified (without loops and variables) goes as follows:
Code:
.Cells(592, 22).Formula = "= " & .Cells(592, 22).Value & " + " & .Cells(676, 18).Value
Now, sometimes the evaluation of this code results in an error. After long debugging, I found out that this happens in cells for which .Cells(592, 22) contains a lot of decimals (for example 0,999999999996).
If I change this number to 1, the program does what it should do without any problem.
I tried to set the decimal designator to . instead of a comma (",") but that doesn't make any difference.
Of course, I can first replace each cell by its rounded equivalent, but that's not very effective...
Is it normal that this happens? What is it due to? Is there any way around it?
If anyone has any clues, thanks for sharing!