Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GUS GUS is offline
external usenet poster
 
Posts: 45
Default lost decimal places

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Decimal places Tricia Excel Worksheet Functions 2 October 27th 08 03:14 AM
Subtracting two 2-decimal place numbers gives result 13-decimal places? [email protected] Excel Worksheet Functions 5 March 12th 07 10:38 PM
Decimal Places Rab Swinney Excel Discussion (Misc queries) 5 January 10th 07 07:01 PM
FIXED 2 DECIMAL PLACES, MUST ENTER ALL ZEROES AFTER DECIMAL POINT. SUKYKITTY Excel Discussion (Misc queries) 3 July 6th 05 01:50 PM
decimal places HB Excel Discussion (Misc queries) 4 March 15th 05 02:19 AM


All times are GMT +1. The time now is 07:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"