View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default VBA Mod, Excel Floor, etc.

This works as the Excel Mod does

Dim N As Double
Dim remain As Double
Dim sign As Boolean

N = 123.456
sign = N < 0
remain = N - Int(N)
MsgBox remain


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"LesHurley" wrote in message
...
In VBA, I want to find the fractional part of a number, say N=123.456.
The
VBA version of Mod rounds N to an integer before it functions. The
WorksheetFunction Mod() isn't available in VBA. WorksheetFunction.Floor()
is
available but it wont work with a negative N. Can anyone suggest how to
do
this for any real N?
--
Thanks for your help