Sub Locate(Name As String, Data As Range)
X = 2
Dim rngFind As Range
Dim strFirstFind As String
With Data
Set rngFind = .Find(Name, LookIn:=xlValues, LookAt:=xlPart)
If Not rngFind Is Nothing Then
strFirstFind = rngFind.Address
Do
If rngFind.Row > 1 Then
Me("ComboBox" & X).AddItem rngFind.Offset(, 1).Value
End If
Set rngFind = .FindNext(rngFind)
Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstFind
End If
End With
End Sub
Private Sub UserForm_Activate()
Dim I As Integer
Dim searchfor As String
I = 2
searchfor = ComboBox1.Value
Do Until Sheets("Blad1").Cells(I, 1).Value = Empty
ComboBox1.AddItem Sheets("Blad1").Cells(I, 1).Value
I = I + 1
Loop
For I = ComboBox1.ListCount - 1 To 1 Step -1
If ComboBox1.List(I) = ComboBox1.List(I - 1) Then ComboBox1.RemoveItem (I)
Next
End Sub
Private Sub Combobox1_Change()
ComboBox2.Clear
Locate ComboBox1.Value, Sheets("Blad1").Range("A2:A" & Cells(Rows.Count, 1).End(xlUp).Row)
End Sub