View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Return fractional part of values

don't know why...

The operative sentence in XL/VBA Help ("Mod"):

The modulus, or remainder, operator divides number1 by number2
***(rounding floating-point numbers to integers)***

Instead use

With ActiveCell
dValue = .Value - Fix(.Value)
End With

In article ,
XP wrote:

In an internal VBA calculation, I need to return the fractional part of a
value in a cell.

For example,

5.35 returns 0.35

7.00 returns 0

I thought: dValue = ActiveCell.Value Mod 1

would do it, but this doesn't work...don't know why...

Thanks much in advance for your assistance.