ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   textbox question (https://www.excelbanter.com/excel-programming/306481-textbox-question.html)

dok112[_22_]

textbox question
 
Hello,

I have 3 textboxes, and need some help....textbox1 is a input box
textbox2 is a generated number box and textbox3 is a total box. I nee
some help making textbox3 work.

IE.
Textbox1.value = "$400.00"
Textbox2.value = "$0.00" (running total)
Textbox3.value = "0.00" (sum of textbox1 - textbox2)

How do I tell textbox 3 to take the value from textbox1 and subtrac
the value in textbox2 to give the total remaining in textbox3

--
Message posted from http://www.ExcelForum.com


William[_2_]

textbox question
 
If you can dispense with the currency symbols and assuming the text boxes
are on a UserForm then you could use something like:-

Private Sub TextBox1_Change()
TextBox3 = Val(TextBox1) - Val(TextBox2)
End Sub

Private Sub TextBox2_Change()
TextBox3 = Val(TextBox1) - Val(TextBox2)
End Sub

But you'll need to make sure (ie. error check or amend the code to deal
with currency symbols) that users only enter valid numbers into the text
boxes since the code converts the text into numbers.

--
XL2002
Regards

William



"dok112 " wrote in message
...
| Hello,
|
| I have 3 textboxes, and need some help....textbox1 is a input box,
| textbox2 is a generated number box and textbox3 is a total box. I need
| some help making textbox3 work.
|
| IE.
| Textbox1.value = "$400.00"
| Textbox2.value = "$0.00" (running total)
| Textbox3.value = "0.00" (sum of textbox1 - textbox2)
|
| How do I tell textbox 3 to take the value from textbox1 and subtract
| the value in textbox2 to give the total remaining in textbox3?
|
|
| ---
| Message posted from
http://www.ExcelForum.com/
|




All times are GMT +1. The time now is 11:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com