-
The following code is used to compare two numbers:
Dim sngValues(2) As Single
Dim intAmount As Integer
Dim sngTestValue As Single
sngValues(0) = 63.7
If round(100 * sngValues(0)) = 100 * sngValues(0) then
msgbox "YES"
else
end
endif
Yet the msgbox for this particular number never occurs??????
Any ideas???
-
I tried your code and the message box appears for me.
-
Singles
Very odd!
Have you tried re-booting...:)
Cheers,
Paul.
-
DOH!
-
What?!???
what number, where, how, why - you've been fibbing again, haven't you....
Paul.
-
Me-I never lie!
sngValues(0) = 1.359293
If round(100 * sngValues(0)) = 100 * sngValues(0) then
msgbox "YES"
else
end
endif
Sorry this is the correct bit of code, as to how and why not sure a colleague is using it and asked me to place it on this wonderful site for real VB programmers to ponder!
-
Well it wouldn't work, would it?
Round 135.9293 is 136 (i.e. <> 135.9293
DOH...
Use this to see what is going on...
MsgBox Round(100 * sngValues(0)) & ", " & 100 * sngValues(0)
Cheers,
Paul.