MACRO para buscar datos en una hoja y colocarlo en un label
Tengo este código el cual me funciona bien (representación de buscarv )
Si funciona bien cuando coloco LETRAS y números para buscarv
Pero cuando coloco solo números este ya no me funciona, hay alguna otra forma de realizar la búsqueda
If Not TextBox1.Value = Empty And Not Label3.Caption = Empty Then
MsgBox "ya haz iniciado el verificador", , "AVISO"
Exit Sub
End If
If TextBox1.Value = Empty Then
MsgBox "No hay clave para realizar busqueda", vbExclamation, "AVISO"
Exit Sub
End If
On Error GoTo h
Set b = Sheets(Hoja2.Name)
valor = b.Application.WorksheetFunction.VLookup(UCase(TextBox1.Value), Sheets("COLABORADORES").Range("B:C"), 2, 0)
valor2 = b.Application.WorksheetFunction.VLookup(UCase(TextBox1.Value), Sheets("COLABORADORES").Range("B:D"), 3, 0)
Label3.Caption = valor
Label4.Caption = valor2
VERIFICADOR_SALIDA_COMER
Exit Sub
h:
MsgBox "Error, El dato que ingresas es incorrecto", vbCritical, "ErrR1"
TextBox1.Value = Empty
TextBox1.SetFocus
End Sub
1 Respuesta
Respuesta de Dante Amor
1