View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default Not rounding numbers in VBA

Long is short for "long integer" so it will store whole numbers only
which is why this is getting rounded up to 4. Change you data type to
Single or Double.

Hope this helps
Rowan

serdar wrote:
sorry im not sure but:

i call smt like:

MoveItem("x", 3.514) or MoveItem("x", "3.514")

and in the moveItem:

With Worksheets("y").Cells(1, 1)
.NumberFormat = "General"
.Value = myValue
End With

...makes it 4 again. It works when i don pass a variable.What happens?
(variable is a Long)



"Ron de Bruin" , haber iletisinde şunları
...

You can use this

With Cells(1, 1)
.NumberFormat = "General"
.Value = "3.514"
End With


--
Regards Ron de Bruin
http://www.rondebruin.nl


"serdar" wrote in message
...

Cells(1, 1) = "3.514"

This gives 4 in A1. Is it possible to pass the actual value without
preformatting the cell?