excel macro returning the wrong value
Hi Folks
Not sure if this has already been posted.
I have set up two variables as double in an excel macro and populated them with two values from cells in the workbook. Using Msgbox I print out the variables and get the expected values of 14.1 and 14.1. I use a further Msgbox to print out the difference between the two variables (variable 1 - variable 2) and I get -1.77635683940025E-15
I was expecting this to be zero.
I have tried recreating the excel file and making sure that the cells are all formatted as numbers with 1 decimal place.
I have tried setting the variables to zero immediately before inserting the values.
This is in a loop and other values are correct.
What am I doing wrong?
|