PDA

View Full Version : Solved: Printing Zeros. 1.000 Zeros disappear, why?



itipu
06-12-2007, 06:08 AM
Hi there,

I have something like this
objExcel.Cells(x, 3).Value = "1.000"

But zeros disappear in the spreadsheet, and I get 1 instead of 1.000 any idea how to resolve this?

Thanks a lot

Mike

mikerickson
06-12-2007, 06:38 AM
1 = 1.000 , so when stored as a number, all leading and trailining zeros go away. You can format the cell to "#.000", which will display the three decimal places.
or you could store it as a string

objExcel.Cells(x,3).Value = "'" & Format(1.000, "#.000")

Bob Phillips
06-12-2007, 08:07 AM
I would do



With objExcel.Cells(x, 3)
.Value = 1
.NumberFormat = "#,##0.000"
End With


to keep it as a number not text