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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Inches to Feet

Status
Not open for further replies.

ncar35b

Technical User
Jan 10, 2003
55
US
Help! I can't figure out how to logically convert inches to feet, so the remainder is in inches. For example, I have 37.235 inches. I would like it to be displayed as 3ft 1.235in.

Using the Mod operator would be nice, but it rounds off the numbers!

Thanks for any help.
 
Try:

Feet = inches \ 12 'note the backslash for integer division
remaininginches = inches - (feet * 12)

Lee
 
It's not really that hard... here's the long and short of it... I'm sure you can shorten it, but this is just a quickie!!
Code:
inches = 37.235 
feet = int(inches/12)
remainder = (inches-(feet*12))
msgbox("Inches = " & inches & vbCrLf & "Conversion = " & feet & "ft " & remainder & "in.")


-SWarrior
 
Dayam !!!!

I didn't know that the \ was for integer division!!
Ya learn something new everyday !!

-SWarrior
 
Doh!

(repeat after me) "Read thoroughly before inserting foot into mouth.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top