View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jhahes[_51_] jhahes[_51_] is offline
external usenet poster
 
Posts: 1
Default prevent rounding up


I am exporting external data from a database into excel.

There are 3 columns full of data that are exported into excel as tex
format.

They are A, C and D

The problem I am having right now is that when I export the dat
everything works however, when I run the following code it is changin
exported data in a cell i.e.(4.75) to 5. Is there anyway to have thi
remain the same without rounding up.

Here is my code:

Do
ActiveCell.Value = CDbl(ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Value = ""
Dim LastRowWithItemNumber As Integer
LastRowWithItemNumber = ActiveCell.Row - 1
Dim cell As Range
Range("C2").Select
For Each cell In Range("C2:D" & LastRowWithItemNumber)
If cell.Value < "" Then cell.Value = CLng(cell.Value)
Next
MsgBox "Update Finished

--
jhahe
-----------------------------------------------------------------------
jhahes's Profile: http://www.excelforum.com/member.php...fo&userid=2359
View this thread: http://www.excelforum.com/showthread.php?threadid=52579