Mostrar solo una vez los datos
Para Dante Amor
¿Hola Dan como estas?
Recurro a su ayuda por favor!
Tengo el siguiente código que esta en un combobox "ComboBoxCodigo_Reb" al seleccionar un dato otro combobox "ComboBoxLote_Reb" muestra datos relacionados pero muestra repetidos y yo quiero que se muestre solo una vez cada dato relacionado acá va el código del combobox "ComboBoxCodigo_Reb"
Gracias
Saludos
Private Sub ComboBoxCodigo_Reb_Change()
Application.ScreenUpdating = False
On Error Resume Next
'Me.ListBox2.Clear
Dim myrange As Range, i As Integer, Celdi As Range, NameCeldi
i = Sheets("Registros").Range("A" & Rows.Count).End(xlUp).Row
Set myrange = Sheets("Registros").Range("A2:A" & i)
ComboBoxLote_Reb.Clear
Set Celdi = myrange.Find(What:=ComboBoxCodigo_Reb.Text)
If Not Celdi Is Nothing Then
NameCeldi = Celdi.Address
Do
If Cells(Celdi.Row, "G") > 0 Then
With ComboBoxLote_Reb
.AddItem Sheets("Registros").Range("B" & Celdi.Row)
.Column(1, .ListCount - 1) = Celdi.Row
End With
End If
Set Celdi = myrange.FindNext(Celdi)
Loop While Not Celdi Is Nothing And Celdi.Address <> NameCeldi
End If
If ComboBoxLote_Reb.ListCount > 0 Then
With ComboBoxLote_Reb
.Visible = True
.ListIndex = 0
End With
End If
Application.ScreenUpdating = True
end sub
1 Respuesta
Respuesta de Dante Amor
2