LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default CSng adds erroneous digits to the value

I'm stumped with what's happening here. I have a value in a CSV that I
want to round. I wanted to use CSng to force the single data type so
that an error would not occur from trying to round a text string. My
code is simple:

Cells(i, 8).Value = Round(CSng(Cells(i, 10).Value, 4))

where i is an integer used in a loop to run down the cells in columns 8
and 10.

For some reason when I set the value in Cell(i,8), Excel is adding some
apparently random erroneous digits to the end of the value. So for
example, a value appearing as 12.1294 in Cell(i,10) comes out as
12.12946789 in Cell(i,8). It appears to be something that happens when
I insert the value into a cell too. If I just display
Round(CSng(Cells(i, 10).Value, 4))
in a Msgbox everything looks fine. Anybody know what might be causing
this? I'm running MS VB 6.0 with MS Excel 2000.

 
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
Excel adds significant digits, resulting in errors in calculations Scoutwert Excel Worksheet Functions 6 September 19th 06 03:27 PM
Excel strange (erroneous?) decimal behaviour DoctorG Excel Programming 8 October 25th 05 09:30 AM
FIND or SEARCH Returning Erroneous #VALUE? Patrick McDonald Excel Worksheet Functions 3 October 5th 05 06:27 PM
Erroneous Regression on Residuals Scott Excel Discussion (Misc queries) 3 July 27th 05 01:53 AM
Apparently Erroneous Resource Error Message JP[_11_] Excel Programming 9 November 22nd 04 06:19 PM


All times are GMT +1. The time now is 06:25 AM.

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

About Us

"It's about Microsoft Excel"