LLenar los TextBox, clicado en una de las tantas lineas dentro del ListBox

El titulo lo dice

Como esta el ejemplo que te envío, si elimino la hoja Clientes el formulario no abre porque algo le hace falta la hoja Clientes y esa es para eliminar del libro

Te envío el ejemplo

1 respuesta

Respuesta
1

Si el cliente no existe te envía el mensaje "El cliente no existe"

Private Sub lista_Click()
'    Dim v   As Variant
'    Dim txt As MSForms.TextBox
'    Dim i%
'    On Error Resume Next
    v = Array(txtRIF, txtNombre, txtDirecci, txtP_Ciud, txtTelf1, txtTelf2, txtFech)
    With Sheets("CLIENTES")
        For i = 0 To UBound(v)
            Set txt = v(i)
            txt.Text = ""
            Set txt = Nothing
        Next
        cliente = lista.List(lista.ListIndex, 0)
        Set b = .Range("A:A").Find(cliente, lookat:=xlWhole)
        'rw = .Range("a2:a50000").Find(lista, LookAt:=xlWhole).Row 'ANTES B5
        If Not b Is Nothing Then
            For i = 0 To UBound(v)
                Set txt = v(i)
                txt.Text = .Cells(b.Row, i + 1)
                Set txt = Nothing
            Next
        Else
            MsgBox "Cliente no existe"
        End If
    End With
    Buscar.SetFocus
    txtRIF.Enabled = False
End Sub

sal u dos

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas