Posted to microsoft.public.excel.programming
|
|
How do I isolate the Fractional part of a number in Excel VB?
Dim Num as double
num = 23.0891467
num = num - int(num)
Is one way.
Cumulous wrote:
I'm a novice writing a VB program in Excel 2003, and I need to isolate
the fractional part of a number. In other words...
Input: 23.0891467
Output: 0.0891467
The only way I know of to do this is (Result = Input Mod 1). The
problem, is that while the Mod Operator works as a Worksheet Function - when
used as a VB Operator, Excel truncates the fractional portion of the result.
This, of course, makes it useless to me.
I need to know the best way to isolate the fractional portion of a
number (with maximum precision), that will work in Excel VB.
Any help will be appreciated! Thanks! :)
--
Dave Peterson
|