PDA

View Full Version : Really Quick Precision Question



Saladsamurai
10-23-2009, 05:42 AM
I have the following

If .Cells(i, j) > 68 Then
Do some stuff

The problem is Excel looks at the whole value in Cells(i, j) but I just want it to look up to the tens place.

So if in the wrksht you see 68.0 in Cells(1, 1) that should return false, but since it is really 68.000001, it returns true.

How do I remedy this?

Saladsamurai
10-23-2009, 05:59 AM
I think this should do it:

If Round(.Cells(i, j), 1) > 68 Then
Do some stuff

mdmackillop
10-23-2009, 02:36 PM
CInt(.Cells(i,j)) or CLng(.Cells(i,j)) will give the integer part of the number.