Dec 31, 2001 #1 Dannybe2 Programmer Jan 31, 2001 136 GB How do I divide a number by another and create a remainder: Eg. 1523 / 60 = 25.3833333 1523 / 60 = 25 R23
How do I divide a number by another and create a remainder: Eg. 1523 / 60 = 25.3833333 1523 / 60 = 25 R23
Dec 31, 2001 #2 Quehay Programmer Feb 6, 2000 804 US Not sure if there's something more efficient... You could use: Dim sglRMNDR as single sglRMNDR = (n1 / n2) - (n1 \ n2) The second operator (\)is the Integer Division operator. Upvote 0 Downvote
Not sure if there's something more efficient... You could use: Dim sglRMNDR as single sglRMNDR = (n1 / n2) - (n1 \ n2) The second operator (\)is the Integer Division operator.
Dec 31, 2001 #3 kevinclark Programmer May 20, 2001 285 CA If there is no function available you could create your own Example Sub Button1_Click() MsgBox GetRemainder(23, 5) End Sub Function GetRemainder(Num1 As Integer, Num2 As Integer) As Integer MyVal = Num1 \ Num2 GetRemainder = Num1 - (MyVal * Num2) End Function Upvote 0 Downvote
If there is no function available you could create your own Example Sub Button1_Click() MsgBox GetRemainder(23, 5) End Sub Function GetRemainder(Num1 As Integer, Num2 As Integer) As Integer MyVal = Num1 \ Num2 GetRemainder = Num1 - (MyVal * Num2) End Function
Dec 31, 2001 #4 MisterC IS-IT--Management Apr 19, 2001 501 US 1523 MOD 60 -------------- A little knowledge is a dangerous thing. Upvote 0 Downvote