ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sum value of four textboxes into another text box (https://www.excelbanter.com/excel-programming/424897-sum-value-four-textboxes-into-another-text-box.html)

ron mann

sum value of four textboxes into another text box
 
In my userform I have four text boxes. I need to total the value of the first
three text boxes into the forth text box on a change event in any of the
first three text boxes. The values are all currency to two decimal places.

I have done a bit of reading on this but simply can not crack the answer.

Any assistance with the code to do this would be greatly appreciated.

--
Thanks

Ron

Eduardo

sum value of four textboxes into another text box
 
Hi Ron,
try

If IsNumeric(Me.TxtI1.Value) _
And IsNumeric(Me.Txt2.Value) _
And IsNumeric(Me.Txt3.Value) Then
Me.TxtGrossRevenue.Value = CDbl(Me.Txt1.Value) _
+ CDbl(Me.Txt2.Value) _
+ CDbl(Me.Txt3.Value)

Hope this help

"ron mann" wrote:

In my userform I have four text boxes. I need to total the value of the first
three text boxes into the forth text box on a change event in any of the
first three text boxes. The values are all currency to two decimal places.

I have done a bit of reading on this but simply can not crack the answer.

Any assistance with the code to do this would be greatly appreciated.

--
Thanks

Ron


ron mann

sum value of four textboxes into another text box
 
Hi Eduardo,

Based on the code provided by you I have added the code below and the form
works perfectly. Your advice and assistance with this matter is very much
appreciated.

Thanks

Ron.

Private Sub TextBox11_change()
If IsNumeric(TextBox11.Value) Then
Me.TextBox17.Value = CDbl(TextBox11.Value)
End If

End Sub

Private Sub TextBox12_change()
If IsNumeric(TextBox11.Value) _
And IsNumeric(TextBox12.Value) Then
Me.TextBox17.Value = CDbl(TextBox11.Value) + CDbl(TextBox12.Value)
End If

End Sub

Private Sub TextBox13_change()
If IsNumeric(TextBox11.Value) _
And IsNumeric(TextBox12.Value) _
And IsNumeric(TextBox13.Value) Then
Me.TextBox17.Value = CDbl(TextBox11.Value) + CDbl(TextBox12.Value) +
CDbl(TextBox13.Value)
End If

End Sub
Private Sub TextBox14_change()
If IsNumeric(TextBox11.Value) _
And IsNumeric(TextBox12.Value) _
And IsNumeric(TextBox13.Value) _
And IsNumeric(TextBox14.Value) Then
Me.TextBox17.Value = CDbl(TextBox11.Value) + CDbl(TextBox12.Value) +
CDbl(TextBox13.Value) _
+ CDbl(TextBox14.Value)
End If

End Sub
--
Thanks

Ron


"Eduardo" wrote:

Hi Ron,
try

If IsNumeric(Me.TxtI1.Value) _
And IsNumeric(Me.Txt2.Value) _
And IsNumeric(Me.Txt3.Value) Then
Me.TxtGrossRevenue.Value = CDbl(Me.Txt1.Value) _
+ CDbl(Me.Txt2.Value) _
+ CDbl(Me.Txt3.Value)

Hope this help

"ron mann" wrote:

In my userform I have four text boxes. I need to total the value of the first
three text boxes into the forth text box on a change event in any of the
first three text boxes. The values are all currency to two decimal places.

I have done a bit of reading on this but simply can not crack the answer.

Any assistance with the code to do this would be greatly appreciated.

--
Thanks

Ron



All times are GMT +1. The time now is 10:32 PM.

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