اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

الردود الموصى بها

  • 2 weeks later...
قام بنشر

تم تعديل الدالة بناء علي موضوع فى قسم الأكسس ، و التعديل من أجل أخذ الأرقام السالبة فى الاعتبار

Function ROUNDTO(MYNO As Double, MyFraction As Double)

' to round up or down with a certain value

Dim MYBASE As Double, MYREM As Double


If Abs(Round(MyFraction, 2)) <= 0 Then

ROUNDTO = MYNO

Exit Function

End If


Dim neg As Boolean

neg = False

If MYNO < 0 Then neg = True


MYNO = Abs(MYNO * 100)

MyFraction = MyFraction * 100


MYREM = MYNO Mod MyFraction

'MsgBox "rem : " & MYREM

MYBASE = MYNO - MYREM

'MsgBox "Base : " & MYBASE


If MYREM > 0 Then

If MYREM > MyFraction / 2 Then

ROUNDTO = MYBASE + MyFraction

Else

ROUNDTO = MYBASE

End If


Else

ROUNDTO = MYNO

End If

ROUNDTO = ROUNDTO / 100

If neg = True Then ROUNDTO = -ROUNDTO

End Function

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information