Hi all, don't normally do this, but can anyone shed some light on this one for me please?
http://209.120.143.185/showthread.ph...hreadid=181256
Printable View
Hi all, don't normally do this, but can anyone shed some light on this one for me please?
http://209.120.143.185/showthread.ph...hreadid=181256
This should help:
Code:Private Sub Command1_Click()
Dim TempNo As Double
TempNo = ModMe(9, 2)
MsgBox TempNo
End Sub
Private Function ModMe(fdNumber As Double, fdDivisor As Double) As Double
Dim fNum As Variant
If fdDivisor = 0 Then
MsgBox "Divisor must be greater than 0"
Exit Function
End If
If fdNumber < fdDivisor Then
ModMe = fdNumber
Exit Function
End If
fNum = fdNumber / fdDivisor
If InStr(1, fNum, ".") Then
fNum = CDbl(Right(fNum, Len(fNum) - (InStr(fNum, ".") - 1)))
fNum = fNum * fdDivisor
ModMe = Round(fNum, 0)
Else
ModMe = 0
End If
End Function