Create an Inputbox that converts a measurement from inches to centimeters. Show the answer with a Msgbox.
Remember that in most cases there is more than one way to solve the exercise.
Hint: One inch is 2.54 centimeters.
Declare the variable Inches Dim Inches As Long
Assign the value of the InputBox variable
Inches = InputBox("How much in Inches would you like to convert to Centimeters?")
Multiply the value of the variable by 2.54 to display the Msgbbox.
MsgBox Inches * 2.54 & " cm."
Sub Solution() Dim Inches As Long Inches = InputBox("How much in Inches would you like to convert to Centimeters?") MsgBox Inches * 2.54 & " cm." End Sub
SuperExcelVBA.com is learning website. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. All Rights Reserved.
Excel ® is a registered trademark of the Microsoft Corporation.
© 2023 SuperExcelVBA | ABOUT