TextBox Addition

rockchalk33

Board Regular
Joined
Jan 12, 2016
Messages
111
Hey all,

Using a button to open a Userform. I need the values in TextBox1 and TextBox2 to be 0. I have a TextBox3 and using TextBox3_Change if the letter "A" is typed into TextBox3 I need to keep a running total in TextBox1 (0+1+1+1+1...each time the letter A is typed) and if the letter "B" is typed it keeps a running total in TextBox2.

Thanks for the help, should be an easy fix I believe!

Devin
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You would need these two script:

Code:
Private Sub TextBox3_Change()
If TextBox3.Value = "A" Then TextBox1.Value = TextBox1.Value + 1
If TextBox3.Value = "B" Then TextBox2.Value = TextBox2.Value + 1
TextBox3.Value = ""
End Sub


Private Sub UserForm_Initialize()
TextBox1.Value = 0
TextBox2.Value = 0

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,388
Messages
6,124,659
Members
449,178
Latest member
Emilou

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