Public Function Modulo(ByVal pNumerator As Double, ByVal pDenominator As Long) As Integer
' round off the numerator and denominator (ensure number is .0)
pNumerator = Int(pNumerator + 0.5)
pDenominator = Int(pDenominator + 0.5)
' Emulate modulo arithmetic
Modulo = pNumerator - (pDenominator * Fix(pNumerator / pDenominator))
End Function