View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
LesHurley LesHurley is offline
external usenet poster
 
Posts: 61
Default VBA Mod, Excel Floor, etc.

This works fine for my application but , for future reference, it always
returns a positive fraction.
--
Thanks for your help


"Gary''s Student" wrote:

Sub fracpart()
x = Application.InputBox(prompt:="", Type:=1)
x = Abs(x) - Int(Abs(x))
MsgBox (x)
End Sub

will give the fractional part of both positives and negatives as a positive.
--
Gary''s Student - gsnu200766


"LesHurley" wrote:

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