View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default lost decimal places

Are your cells formatted to show no decimal places? If you select the cell
and look in the formulabar, does it display the decimal portion?




For i = 0 To Me.ListBox1.ListCount - 1
For j = 0 To Me.ListBox1.ColumnCount - 1
With Worksheets("TEMPPINAKAS")
.Cells(i + 2, j + 2).Value = _
Me.ListBox1.List(i, j)
if instr(Me.Listbox1.List(i,j),".") then
.Cells(i + 2, j + 2).NumberFormat = "General"
end if
End With
Next j
Next i

If your decimal separator is a comma rather than a period (full stop) then
you might need to do

For i = 0 To Me.ListBox1.ListCount - 1
For j = 0 To Me.ListBox1.ColumnCount - 1
With Worksheets("TEMPPINAKAS")
.Cells(i + 2, j + 2).Value = _
cDbl( Me.ListBox1.List(i, j))
end if
End With
Next j
Next i

--
Regards,
Tom Ogilvy



GUS wrote in message
...
I am using the next code in order to place some values from a list to
cells
the code works fine except if the values has decimal places
When the values are pasted at cells they are loosing their decimal

places.


For i = 0 To Me.ListBox1.ListCount - 1
For j = 0 To Me.ListBox1.ColumnCount - 1
Worksheets("TEMPPINAKAS").Cells(i + 2, j + 2).Value =
Me.ListBox1.List(i, j)
Next j
Next i

Any ideas.