Is it possible to group Excel form controls with the Change event ?
Posted on 2013-12-05
I have an Excel VBA user form with a multi-page control (of 4 pages) each containing 6 text box controls. All 24 text boxes will contain a person's name.
If a text box value changes I want to call a small procedure to check the value of that text box. My code looks like this....
Private Sub teDelegateName1_1_Change()
x = 1
Private Sub teDelegateName1_2_Change()
x = 1
.........the above procedure is repeated for all 24 text fields
Private Sub CountNoOfDelegates(x)
Dim cnt As Long
cnt = 0
For i = 1 To 6
If Me.Controls("teDelegateName" & x & "_" & i) <> "" Then
cnt = cnt + 1
Is there anyway I can reduce the amount of code rather than having to set up a separate change procedure for each of the text box controls ?