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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

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