VBA EXPERTS: I need to make a user form to convert from metric to inches

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
821
Office Version
  1. 365
Platform
  1. Windows
Thanks for looking at my post. I need to create a Userform that will pop up on clicking a form control button that has a text box some one can enter in a number in metric and click a button and it convert it to inches.
Example: 145.6 to 5.7323
mm inch
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
ok, how about anyone that knows anything about VBA. I no very little so everybody is a expert compaired to me.
 
Upvote 0
All I really need is how to make the code for saying value of txtbox1(mm) divided by 25.4 = textbox2 that contains the answere or a label would work too. thanks
 
Upvote 0
Something like this (for Milimeters to Inches):

Me.TextBox1.Value = Me.TextBox1.Value * 0.0393700787

HTH,
 
Upvote 0
Thanks Smitty, i just tried your code and it debuged. The only number that it will let me put in the text box is 0
 
Upvote 0
Smitty what does the Me. do ? Im not sure whats wrong the code you provided seem pretty cut and dry
 
Upvote 0
Thanks Smitty, i just tried your code and it debuged. The only number that it will let me put in the text box is 0

For the Debug error, what error message did you get?

For the second, check the TextBox's properties to make sure that you're not limiting it.
 
Upvote 0
This is the line of code you gave me I adjusted

Private Sub TextBox1_Change()
Me.TextBox1.Value = Me.TextBox1.Value / 25.4
End Sub

The error is Runtime error '13': Type mismatch

Im not sure what in the properties I need to adjust
 
Upvote 0

Forum statistics

Threads
1,215,350
Messages
6,124,430
Members
449,158
Latest member
burk0007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top