Colin,
This works great in a formula.
=MOD(A1, 1)
In
VB this does not work due to the rounding of values by the Mod Operator. I was looking for some options that would work well in
VB.
val = Range(A1) Mod 1
The modulus, or remainder, operator divides number1 by number2 (rounding floating-point numbers to integers) and returns only the remainder as result.
I'm pasting some values from a pivot table into another sheet and want to set the decimal to 1 place if it has a decimal or 0 decimals if it is a whole number. The original formula I posted is doing the trick. I was curious about optional ways of doing this.
Thanks for the suggestions.