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

#### 34sweetness

##### Board Regular
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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

#### Andrew Poulsom

##### MrExcel MVP
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.

#### 34sweetness

##### Board Regular
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.

#### Andrew Poulsom

##### MrExcel MVP
Sorry, I forgot that quirk:

Code:
``TextBox4.Value = Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value)``

#### 34sweetness

##### Board Regular
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!

Replies
3
Views
206
Replies
6
Views
212
Replies
5
Views
439
Replies
3
Views
450
Replies
3
Views
969

1,181,091
Messages
5,928,034
Members
436,583
Latest member
AlxBtx

### 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.

### Which adblocker are you using?

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

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