Ok, i'll tell you what to do and send a sample.
You need the following in your userform
Private colCustomTBs As Collection
Private Sub UserForm_Initialize()
Dim ctl As Control
Dim clsCustomTB As clsCustomTextBox
Set colCustomTBs = New Collection
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then
Set clsCustomTB = New clsCustomTextBox
Set clsCustomTB.CUSTOMTB = ctl
colCustomTBs.Add clsCustomTB
End If
Next ctl
End Sub
Then you need a class, called clsCustomTextBox, which has the code
Private WithEvents customTextBox As MSForms.TextBox
Public Property Set CUSTOMTB(objIn As MSForms.TextBox)
Set customTextBox = objIn
End Property
Private Sub customTextBox_Change()
If Mid(customTextBox.Name, 1, 1) = "I" Then
' Your code
End If
End Sub
What this does is pass every textbox on the form initialisation and diverts it to be our customtextbox, which is inherited from MsForms.Textbox, we just mess about with the events.
HTH
Bookmarks