Use a text box to calculate and show results in a user form

G

Guest

I think this is a simple operation but I can not find the way to do it.
I have a excel user form with 3 text boxes, tb1, tb2 and tb3. I want to use
tb3 to show the results of the enteries made in tb1 & 2. For example
tb1 = Maximum
tb2 = Minimum
tb3 = Maximum - Minimum
After the entry is made in tb2 then tb3 will automatically show the
calculated result as the user will not be allowed to move onto that textbox.
At this point the record wil is part of a larger form and not updated to the
worksheet.

Regards
 
M

Mangesh Yadav

In the change event for the first two textboxes, put the formula:

tb3 = tb2 - tb1

Mangesh
 
G

Guest

sorry to be a pain but where do I find this to enter the text ? - thanks for
the quick reply
 
M

Mangesh Yadav

In your user_form, double click on the textbox tb1, this will open the VBE
with the following:

Private Sub tb1_Change()
tb3 = tb2 - tb1
End Sub

Repeat for the second textbox.

Mangesh
 
G

Guest

thanks for that Mangesh but I now get a runtime error 13 type mismatch, I
dint suppose you can help with that, I am using numbers I guess it is looking
for a text or something. Any advice would be great - Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top