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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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,219,161
Messages
6,146,657
Members
450,706
Latest member
LGVBPP

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