Posted to microsoft.public.excel.programming
|
|
Mod Function Returning Long
I knew I hung out around here for a reason... Answers above and beyond the
call of duty...
--
HTH...
Jim Thomlinson
"Bernie Deitrick" wrote:
Jim,
That is true of VB.NET, but not VBA.
"In Visual Basic .NET, the MOD operator no longer accepts variants, and if either operand is a
floating-point number, the result will be a floating-point number."
HTH,
Bernie
MS Excel MVP
"Jim Thomlinson" wrote in message
...
I did not see that anywhere in the help... Must not have looked hard
enough... In MSDN help for VB here is what they say... If number1 or number2
are floating-point values, then division is carried out and the
floating-point remainder is returned. I guess I will have to work around it...
--
HTH...
Jim Thomlinson
"Bob Phillips" wrote:
Jim,
The answer in in Help
The modulus, or remainder, operator divides number1 by number2 (rounding
floating-point numbers to integers)
Note the bit in brackets. VBA Mod behaves differently to Excel Mod.
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Jim Thomlinson" wrote in message
...
What am I missing here...
377.25 Mod 25 is returning 2 instead of 2.25. In the watch window the
result
of the function is a long. Everything I have read I should be getting a
double.
Sub ModTest()
MsgBox 377.25 Mod 25
End Sub
Jim Thomlinson
|