-
Really Quick Precision Question
I have the following
[VBA]If .Cells(i, j) > 68 Then
Do some stuff[/VBA]
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?
-
I think this should do it:
[VBA]If Round(.Cells(i, j), 1) > 68 Then
Do some stuff [/VBA]
-
CInt(.Cells(i,j)) or CLng(.Cells(i,j)) will give the integer part of the number.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules