VBA active x text box

smig123

New Member
Joined
Nov 14, 2012
Messages
9
Wondering if anyone can help. I want to create a user form with two active x text boxes. In box one you put a number and the second box uses a formula to change the number and display the result. For example put 2 in box one and it shows 100 in box 2.

There are many other boxes on the form but i just need these two boxes to work together. I can then add others doing the same with different formulas. I have been on youtube for ever and can't find anything that shows me the code.

Any help gratefully appreciated.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi, you didn't tell us what the "formula" should be, but maybe you can adapt something like this..

Code:
Private Sub TextBox1_AfterUpdate()
If IsNumeric(TextBox1.Value) Then TextBox2.Value = TextBox1.Value * 50
End Sub
 
Last edited:
Upvote 0
Hi, you didn't tell us what the "formula" should be, but maybe you can adapt something like this..

Code:
Private Sub TextBox1_AfterUpdate()
If IsNumeric(TextBox1.Value) Then TextBox2.Value = TextBox1.Value * 50
End Sub



Many thanks i will give it a go. I have many formulas I will be using and I believe i can just do it in a macro to see how VBA handles it. Thanks for the reply.
 
Upvote 0
Final question! if I may.

if i want to round up a result =roundup function for example, textbox1.value * 50 should read?
 
Upvote 0
Hi, you can try like this.

Code:
If IsNumeric(TextBox1.Value) Then TextBox2.Value = Application.RoundUp(TextBox1.Value * 50, 0)
 
Last edited:
Upvote 0
God you are amazing how are we meant to find this stuff......LOL I have just done a 4 day course and in the real world its like i learned nothing. Many thanks
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,996
Members
452,542
Latest member
Bricklin

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