Alertas de búsqueda en formulario excel
Tengo el siguiente código para realizar búsquedas en un formulario, necesito que salga una ventana si el numero buscado no aparece con las opciones si y no (msgbox)
De antemano gracias por su ayuda !
Private Sub CommandButton1_Click()
'
'
ListBox1.ColumnCount = 6
Set h5 = Sheets("BILAN")
ListBox1.Clear
If TextBox1 = "" Then
MsgBox "Veuillez taper un N° série"
Exit Sub
End If
For i = 2 To h5.Range("C" & Rows.Count).End(xlUp).Row
cad = h5.Cells(i, "C")
If cad Like "*" & UCase(TextBox1) & "*" Then
existe = True
With ListBox1
.AddItem h5.Cells(i, "C")
.List(.ListCount - 1, 1) = h5.Cells(i, "D")
.List(.ListCount - 1, 2) = h5.Cells(i, "E")
.List(.ListCount - 1, 3) = h5.Cells(i, "F")
.List(.ListCount - 1, 4) = h5.Cells(i, "G")
.List(.ListCount - 1, 5) = h5.Cells(i, "K")
End With
End If
Next
End Sub