ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   variable amount truncated regardless of # of decimals (https://www.excelbanter.com/excel-programming/359295-variable-amount-truncated-regardless-decimals.html)

Jon Workman[_2_]

variable amount truncated regardless of # of decimals
 
I have a very old excel spreadsheet that I must write data to from an Access
database. I have been able to load in the data into Excel thru VB using a
variant matrix. I have vefied that the amounts retain the correct number of
decimals. It then goes thru all of the data and copies the relevant data to
the relevant sheet.
However when i view the data on the excel sheet, it gets truncated/rounded
to 2 decimals. Even when i change the field to 3 decimals, it shows 12.440
instead of 12.435.

With rs2
Do While Not .EOF
Actmatrix(i, 1) = Trim(![Account_Number])
Actmatrix(i, 8) = ![comsn] <= Comsn =
-12.435
i = i + 1
rs2.MoveNext
Loop
End With

***** later in the code

Workbooks("x2006" & mth & ".xls").Sheets("ExportNLs").Range("L"
& n) = Actmatrix(i, 8) <= on the relevant field, number is -12.44
comsn = Actmatrix(i, 8) <= comsn is -12.435

....

Workbooks("x2006" & mth & ".xls").Sheets("CIS " &
tmpAcct).Range(strColumn & "12") = comsn <= on relevant field,
number is -12.44

I have heard on Value2, but I don't think I can use it here, and "Precision
as Displayed" has no effect.

Can you help? Thanks.




All times are GMT +1. The time now is 05:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com