How do I use the formula for "SUM" in a textbox on a UserFor

34sweetness

Board Regular
Joined
Oct 7, 2002
Messages
136
I have a UserForm that will be used to input inspection data, with a textbox for the Qty Inspected, then several other textboxes to input the number of rejected parts (each textbox for the rejects corresponds to a specific reject code). I then want to have a textbox that will show the sum of the ‘rejects’, meaning I want to add up the total number of rejects. How can I do this, so that the Qty Rejected textbox is ‘automatically’ updated while the data is being input into the ‘reject/code’ textboxes?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
You need to add up the values in your text boxes. Say TextBox1 to TextBox3 are your data entry text boxes and TextBox4 is your total text box:

Code:
Private Sub TextBox1_AfterUpdate()
   TextBox4.Value = TextBox1.Value + TextBox2.Value + TextBox3.Value
End Sub

and repeat for TextBox2 and TextBox3.
 
Upvote 0
On 2002-10-14 12:36, Andrew Poulsom wrote:
You need to add up the values in your text boxes. Say TextBox1 to TextBox3 are your data entry text boxes and TextBox4 is your total text box:

Code:
Private Sub TextBox1_AfterUpdate()
   TextBox4.Value = TextBox1.Value + TextBox2.Value + TextBox3.Value
End Sub

and repeat for TextBox2 and TextBox3.

I did what you stated above, however, this only added the "strings" together. I am entering numbers, and want the total "number" of rejects 'summed up' on the form.
 
Upvote 0
Sorry, I forgot that quirk:

Code:
TextBox4.Value = Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value)
 
Upvote 0
On 2002-10-14 14:15, Andrew Poulsom wrote:
Sorry, I forgot that quirk:

Code:
TextBox4.Value = Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value)
Thanks, that works now. Excellent!
 
Upvote 0

Forum statistics

Threads
1,222,149
Messages
6,164,236
Members
451,882
Latest member
Bigtop

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