View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Maury Markowitz Maury Markowitz is offline
external usenet poster
 
Posts: 86
Default Does rounding work at all?

I still can't understand anything about this.

When I read the value of a cell in VB, the code returns a value rounded to 4
decimal places. The cell in question has a number that is out to about 8
decimals. And I'm not talking about the assignment, if you simply look at the
contents of the cell in the debugger, it's rounded off, ActiveSheet.Cells(i,
9) returns the wrong number!

But it's even worse. In order to get the SQL to find the row in the DB I
have to round both sides and compare the rounded values. So I have code
like...

theSql = theSql & " AND ROUND(value, 3) =" & Round(theTotal, 3)

The cell in question contains the value 1712.1465. Thus, the Round function
on the right side should return 1712.147. Well look what actually happens:

AND ROUND(value, 3) =1712.146

What the HECK is going on?!?

Maury