Jump to content

Problema con codigo Buscar


Go to solution Solved by Antoni,

Recommended Posts

  • Solution
Sub Buscar_dato()
Dim encontrado As Range
'--
If [C4] = "" Then
    MsgBox "Introduzca un Número a buscar", vbInformation, "Número vacío"
    Exit Sub
End If
'--
[C6:C12] = ""
With Sheets("BD")
    Set encontrado = .Columns("B").Find(What:=[C4], LookAt:=xlWhole) 'xlWhole Busca exacto
        If Not encontrado Is Nothing Then
            [C6] = .Cells(encontrado.Row, "C") 'Nombre
            [C8] = .Cells(encontrado.Row, "D") 'CEDULA
            [C10] = .Cells(encontrado.Row, "E") 'ESTACIÓN
            [C12] = .Cells(encontrado.Row, "F") 'BOMBERO
            Range("A1") = True 'Desactiva el CheckBox1 que es de habitaciones
            'CheckBox1
        Else
            MsgBox "No se encuentra el Número introducido" & vbNewLine & vbNewLine & _
             "Compruebe el Número introducido e inténtelo de nuevo", vbInformation, "Error de Número"
            Exit Sub
        End If
End With
'--

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Privacy Policy