Reputation: 387
I have a macro running on excel which copies a number from one sheet to the other
First I store all the relevant numbers in a string array va()
and than assign the array values in the new sheet.
ActiveCell.Offset(0, 5).Value = va(i, 5)
when number is -0,522004, I get the correct result in the new sheet, however when the number is -1,175378 I get -1175378,0000 as output in the excel sheet.
Note that I am using "," as decimal separator and "." as thousand separator.
I also tried to put msgbox va(i,5)
and it shows -1,175378 as output but when the code is complete I get decimal ignored values.
Upvotes: 0
Views: 1882
Reputation: 34045
Assuming your regional settings match the string data (i.e. comma is decimal separator), you can perform an explicit coercion:
ActiveCell.Offset(0, 5).Value = CDbl(va(i, 5))
Upvotes: 1