Buenas
Tal y como te comente ya no aparecen registros repetidos, pero ahora al cargar los datos del combobox no se rellenan el resto de casillas.
Pongo todo el código.
Private Sub UserForm_Initialize()
Dim Fila As Integer, Final As Integer, registro As Integer
Final = Hoja8.Range("A" & Rows.Count).End(xlUp).Row
With Hoja8
For Fila = 2 To Final
registro = WorksheetFunction.CountIf(.Range(.Cells(1, 1), .Cells(Fila, 1)), .Cells(Fila, 1))
If registro = 1 Then
cbo_not.AddItem .Cells(Fila, 1)
End If
Next Fila
End With
ListBox1.ColumnCount = 7
Me.ListBox1.ColumnWidths = "50pt; 150 pt;60 pt;60 pt;250 pt;60 pt;60 pt"
End Sub
Private Sub cbo_not_Change()
Dim Fila As Integer
Dim Final As Integer
If cbo_not.Value = "" Then
Me.cbo_pt = ""
Me.txt_fecha = ""
Me.txt_descrip = ""
Me.eje1 = ""
Me.eje2 = ""
Me.eje3 = ""
Me.txt_equipo = ""
End If
For Fila = 2 To 1000
If Hoja8.Cells(Fila, 1) = "" Then
Final = Fila - 1
Exit For
End If
Next
For Fila = 2 To Final
If cbo_not = Hoja8.Cells(Fila, 1) Then
Me.cbo_pt = Hoja8.Cells(Fila, 3)
Me.txt_equipo = Hoja8.Cells(Fila, 4)
Me.txt_fecha = Hoja8.Cells(Fila, 2)
Me.txt_descrip = Hoja8.Cells(Fila, 5)
Me.eje1 = Hoja8.Cells(Fila, 6)
Me.eje2 = Hoja8.Cells(Fila, 7)
Me.eje3 = Hoja8.Cells(Fila, 8)
Exit For
End If
Next
End Sub
Private Sub CommandButton1_Click()
Dim Fila, Final As Integer
Fila = 2
For Fila = 2 To Final
If Me.cbo_not = Hoja8.Cells(Fila, 1) Then
Exit For
End If
Next
If Me.cbo_not.Value = Empty Then
Me.ListBox1.Clear
' Me.txt_equipo = Empty
' Me.txt_marcaymodelo = Empty
' Me.txt_saldo = Empty
'MsgBox "Escriba un codigo para buscar"
'Me.txt_buscar.SetFocus
' Exit Sub
End If
Me.ListBox1.Clear
items = Hoja8.Range("tabla5").CurrentRegion.Rows.Count
For i = 2 To items
If Hoja8.Cells(i, 1).Value Like Me.cbo_not.Value _
And Hoja8.Cells(i, 2).Value Like Me.txt_fecha Then
Me.ListBox1.AddItem Hoja8.Cells(i, 9)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = Hoja8.Cells(i, 10)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 2) = Hoja8.Cells(i, 11)
' Me.ListBox1.List(Me.ListBox1.ListCount - 1, 3) = Hoja8.Cells(i, 11)
'Me.ListBox1.List(Me.ListBox1.ListCount - 1, 4) = Hoja8.Cells(i, 11)
' Me.ListBox1.List(Me.ListBox1.ListCount - 1, 5) = Hoja3.Cells(i, 12)
'Me.ListBox1.List(Me.ListBox1.ListCount - 1, 6) = Hoja3.Cells(i, 13)
End If
Next i
Exit Sub
End Sub