girapas
Board Regular
- Joined
- Apr 20, 2004
- Messages
- 150
In a userform I have 4 textboxes (tx1, tx2, tx3, tx4) where the user enters numbers.
When a number is entered in any of these textboxes, a corrrespondig textbox
(one of ResultBox1, ResultBox2, ResultBox3, ResultBox4) is populated by a code like this:
Private Sub tx1_Change()
ResultBox1.Value = 2000 * Val(tx1.Text)
ResultBox1.Text = FormatNumber(ResultBox1.Value, 2)
End Sub
So, at each textbox of the ResultBox-column I have numbers like it: 50,000.00
I also have the SUM of the tx1, tx2, tx3, tx4 (in textbox TotalInput) using this code:
TotalInput.Value = Val(tx1.Text) + Val(tx2.Text) + Val(tx3.Text) + Val(tx4.Text)
Things are OK so far. I want the TotalInput number unformatted and I get it.
However, what I need is to have a textbox (TotalResults) with the SUM of the values of
ResultBox1, ResultBox2, ResultBox3, ResultBox4 and with the same format (###,###.00) as above. I've tried the code:
TotalResults.Value = Val(ResultBox1.Text) + Val(ResultBox2.Text) + Val(ResultBox2.Text)_
+ Val(ResultBox4.Text)
FormatNumber(TotalResults.Value, 2) or Format(TotalResults.Value, "#,##0.00") etc.
without succes.
Any help please?
When a number is entered in any of these textboxes, a corrrespondig textbox
(one of ResultBox1, ResultBox2, ResultBox3, ResultBox4) is populated by a code like this:
Private Sub tx1_Change()
ResultBox1.Value = 2000 * Val(tx1.Text)
ResultBox1.Text = FormatNumber(ResultBox1.Value, 2)
End Sub
So, at each textbox of the ResultBox-column I have numbers like it: 50,000.00
I also have the SUM of the tx1, tx2, tx3, tx4 (in textbox TotalInput) using this code:
TotalInput.Value = Val(tx1.Text) + Val(tx2.Text) + Val(tx3.Text) + Val(tx4.Text)
Things are OK so far. I want the TotalInput number unformatted and I get it.
However, what I need is to have a textbox (TotalResults) with the SUM of the values of
ResultBox1, ResultBox2, ResultBox3, ResultBox4 and with the same format (###,###.00) as above. I've tried the code:
TotalResults.Value = Val(ResultBox1.Text) + Val(ResultBox2.Text) + Val(ResultBox2.Text)_
+ Val(ResultBox4.Text)
FormatNumber(TotalResults.Value, 2) or Format(TotalResults.Value, "#,##0.00") etc.
without succes.
Any help please?