View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Get next Integer value

Not sure what you mean?

This example rounds up.

Sub test()
Dim dbl As Double, i As Long

dbl = 3.1
i = -Int(-dbl)
MsgBox i
End Sub

(using 3.1, 3.000000000000001 is precise for VBA)


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Bob Phillips" wrote in message
...
If he declares it as integer, it will implicitly do what is advised here,

it
cannot be 3.000000000000001

Bob

"Rob van Gelder" wrote in message
...
i = -int(-3.000000000000001)

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Stuart" wrote in message
...
If I Dim i As Integer
and then test "A1" for its' value
and if the value in "A1" is 3.00000000000000 and 1

How can I return i = 4 , please?

ie any value 3 but < 4 returns 4

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.586 / Virus Database: 371 - Release Date: 12/02/2004