Problem with write cell



I had a problem using write cell: i had to fill into a cell 840.5
i had done the following write cell activity.


but the result in the excel file is 841 and hence when doing mathematical operation in the excel it will lead to a False result


(your image is not showing)

If you are using 840.5, Excel will automatically round the number, so click on the cell and make sure it says 840.5 in the Value Bar at the top (or by double clicking in the cell).

If the value says 841, then you must be rounding it when you write the cell. If this is the case, make sure you are not using any functions that would round it like Round() or CInt(); maybe even check the value before the Write Cell to make sure it wasn’t rounded.

—the first point I made about Excel rounding it is more likely



Image is not visible to us.
Could you please upload it again?
you can do below,
go to excel and click on that yellow icon below screenshot shows that and choose Convert to Number





Can you verify before the Write Cell that MONTANT.Replace(",",".") = 840.5 ?

Also side note, you don’t need to convert it to a Double like you are doing. You only need to convert it to double to format the number or use it for math and number comparisons.



MONTANT.Replace(",",".") shows 840.5


Can you open the Excel file and verify the cell does not have the cell formatted with zero decimal places by right clicking and choosing Format Cell? Or also check the value by looking in the top Bar or by double clicking the cell.



by double clicking it shows 840.5
but when i need to do addition with for example 2 it gives 843


Excel is formatting it.
Right click the cell and choose Format Cell to verify the formatting:

If Decimal places is set to 0, then it will keep rounding.