(Solved) – Single Variable type array giving transcription error?

(solved)-–-single-variable-type-array-giving-transcription-error?

I declared a single array of size 100 and stored some 6 values in it. I then transferred them to a different Excel workbook. However, when they were transferred they were given extra digits well past their last decimal.

Ex: 1.1, when stored then transferred, gave a value of 1.10000002384185.

I changed the array type to double and it fixed it, but I’m just curious as to what was happening.

Dim Program_LC_Array(100) As Single
Dim y As Long
Dim x As Long

With Workbooks("Workbook1").Sheets("Program")
For x = 2 To 7
    Program_LC_Array(y) = .Range("M" & x).Value
    y = y   1
Next x
y = y - 1
End With

With Workbooks("Workbook2").Sheets("Destination")
For x = 0 To y
    .Range("A" & x).Value = Program_LC_Array(x)
Next x
End With

Leave a Reply

Your email address will not be published. Required fields are marked *