Tracking text box changes

craigyg

Board Regular
Joined
Dec 14, 2005
Messages
114
I am looking for a way to track changes to values in textboxes in a more universal way that a textbox_change subroutine. For example, say I have 20 textboxes on a userform and I would like to track if there has been any changes in values made to the userform. Rather than write a textbox_change sub for each, I would like to have one subroutine that handles all of these at once. Is there a way to do this?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
One way to go about it will something like this:

Code:
Private Sub TextBox1_Change()
Tupdate (TextBox1.Name)
End Sub

Private Sub TextBox2_Change()
Tupdate (TextBox2.Name)
End Sub

Private Sub TextBox3_Change()
Tupdate (TextBox3.Name)
End Sub


Sub Tupdate(texti As String)
Select Case texti
Case "TextBox1"
MsgBox TextBox1.Value
Case "TextBox2"
MsgBox TextBox2.Value
Case "TextBox3"
MsgBox TextBox3.Value
End Select
End Sub

Meaning everytime one textbox changes it runs the same sub having the name of the textbox as parameter.
In the sub you can then depending of the name do the coding you want
 
Upvote 0

Forum statistics

Threads
1,216,515
Messages
6,131,111
Members
449,620
Latest member
MatXm

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