Mostrar detalle de sanción según cliente seleccionado en el listbox

Para Dante Amor

Amigo dante deseo avanzar con la macro y gracias por ayudar

Que muestre en DETALLE DE MULTA todos los registros de las fechas que han sido multadas los clientes, como te muestro en la imagen.

Muy agradecido Saludos!

1 Respuesta

Respuesta
1

H o la.

Esto va en el formulario 2

Private Sub CommandButton1_Click()
    If ListBox1.ListIndex < 0 Then
        MsgBox "Selecciona un registro"
        Exit Sub
    End If
    With UserForm3
        .nombre = ListBox1.List(ListBox1.ListIndex, 1)
        .Show
    End With
End Sub

Esto va en el formulario 3

Public nombre
Private Sub UserForm_Activate()
'Por.Dante Amor
    Set h = Sheets("Multas")
    Set r = h.Columns("D")
    Set b = r.Find(nombre, lookat:=xlWhole)
    If Not b Is Nothing Then
        ncell = b.Address
        Do
            'detalle
            ListBox1.AddItem h.Cells(b.Row, "A")
            ListBox1. List(ListBox1.ListCount - 1, 1) = h. Cells(b.Row, "B")
            ListBox1. List(ListBox1.ListCount - 1, 2) = h. Cells(b.Row, "E")
            Set b = r.FindNext(b)
        Loop While Not b Is Nothing And b.Address <> ncell
    End If
End Sub

Sal u dos

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas