Are these the only textbox controls on the userform? What are the names of the controls? Are they the standard TextBox1, TextBox2, etc.?
Iterate through the Controls property and checks a prefix of names or put the controls into a control Array and iterate through it if you didn't use a common prefix.
You can put the values into an array and use one of various methods to remove duplicates. A search for the work Unique and Array may find a routine easy enough. If the Ubound(arrayname) of each is the same then no duplicates were removed. Collections and a Dictionary object are other methods that would work.
See if this gets you started.
Code:
Sub myControls()
Dim c As Control
Dim a() As Control
Dim i As Long
For Each c In UserForm1.Controls
i = i + 1
Debug.Print c.Name
ReDim Preserve a(i)
Set a(i) = c
Debug.Print "a(" & i; ")", a(i).Name
Next c
End Sub
Here is something that I have used to fill a control with unique values from a range. You can use a similar concept.
Code:
Sub FillCtrlUnique(myRange As Range, myControl As Control)
Dim Coll As New Collection
Dim var As Variant
Dim cell As Range
On Error Resume Next
For Each cell In myRange
Coll.Add Item:=cell.Value, key:=CStr(cell.Value)
Next cell
On Error GoTo 0
With myControl
.Clear
For Each var In Coll
.AddItem var
Next var
End With
Set Coll = Nothing
End Sub