Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Division Question 2

Status
Not open for further replies.

ckeener

Programmer
Dec 2, 2003
53
US
I want to take a number, divide it by 60 and save the whole number as one variable and the remainder as another variable...Does anyone know if there is a way to do this?

ex. 838 / 60 = 13 with a remainder of 58
var1 = 13
var2 = 58

Can this be done with VB?
 
Dim MyNumber as Long
Dim MyQuotient as Long
Dim MyRemainder as Long
Dim MyDivisor as Long

MyNumber = 838
MyDivisor = 60

MyQuotient = MyNumber \ MyDivisor ' \ is the integer divide operator

MyRemainder = MyNumber Mod MyDivisor


 
Thanks bboffin,

That was perfect and well explained. Very understandable. Thank you for the help.

Caleb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top