Te anexo el código completo:
Private Sub ComboBox1_Change()
cargar 2
End Sub
Private Sub ComboBox2_Change()
cargar 3
End Sub
Private Sub ComboBox3_Change()
'Por.Dante Amor
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
For j = 1 To 3
If Cells(i, j) = Controls("ComboBox" & j) Then
igual = True
Else
igual = False
Exit For
End If
Next
If igual Then
ListBox1.AddItem Cells(i, "D")
ListBox1.List(ListBox1.ListCount - 1, 1) = Cells(i, "E")
ListBox1.List(ListBox1.ListCount - 1, 2) = i
End If
Next
End Sub
Private Sub ListBox1_Click()
'Por.Dante Amor
f = ListBox1.List(ListBox1.ListIndex, 2)
TextBox1 = Cells(f, "F")
TextBox2 = Cells(f, "G")
ruta = ThisWorkbook.Path & "\"
imagen = ListBox1.List(ListBox1.ListIndex, 1) & ".jpg"
If Dir(ruta & imagen) <> "" Then
Image1.Picture = LoadPicture(ruta & imagen)
Else
imagen = ListBox1.List(ListBox1.ListIndex, 1) & ".jpeg"
If Dir(ruta & imagen) <> "" Then
Image1.Picture = LoadPicture(ruta & imagen)
End If
End If
End Sub
Private Sub UserForm_Activate()
'Por.Dante Amor
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
agregar ComboBox1, Cells(i, "A")
Next
End Sub
Sub agregar(combo As ComboBox, dato As String)
'Por.Dante Amor
For i = 0 To combo.ListCount - 1
Select Case StrComp(combo.List(i), dato, vbTextCompare)
Case 0: Exit Sub 'ya existe en el combo y ya no lo agrega
Case 1: combo.AddItem dato, i: Exit Sub 'Es menor, lo agrega antes del comparado
End Select
Next
combo.AddItem dato 'Es mayor lo agrega al final
End Sub
Sub cargar(ini)
'Por.Dante Amor
TextBox1 = ""
TextBox2 = ""
ListBox1.Clear
For i = ini To 3
Controls("ComboBox" & i) = ""
Controls("ComboBox" & i).Clear
Next
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
For j = 1 To ini - 1
valor = IIf(IsNumeric(Controls("ComboBox" & j)), _
Val(Controls("ComboBox" & j)), Controls("ComboBox" & j))
If Cells(i, j) = valor Then
igual = True
Else
igual = False
Exit For
End If
Next
If igual Then agregar Controls("ComboBox" & ini), Cells(i, ini)
Next
End Sub
Saludos.Dante Amor