No me sale MsgBox cuando no halla un valor
No me sale el MsgBox cuando no encuentra un valor en la columna A. Adjunto el código.
Private Sub CommandButton1_Click()
On Error GoTo Errores
If Me.TextBox1.Value = "" Then Exit Sub
'Me.ListBox1.Clear
j = 1
Filas = Range("a1").CurrentRegion.Rows.Count
For i = 2 To Filas
If LCase(Cells(i, j).Offset(0, 0).Value) Like "*" & LCase(Me.TextBox1.Value) & "*" Then
Me.ListBox1.AddItem Cells(i, j)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = Cells(i, j).Offset(0, 1)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 2) = Cells(i, j).Offset(0, 2)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 3) = Cells(i, j).Offset(0, 3)
Else
End If
Next i
For x = 0 To ListBox1.ListCount - 1
If ListBox1.List(x, 0) <> "" Then
m = m + 1
End If
Next
TextBox2.Value = m
Exit Sub
Errores:
MsgBox "No se encontro el dato consultado", vbExclamation
End Sub
1 respuesta
Respuesta de Sveinbjorn El Rojo
1