Good afternoon friends, I hope you are well.
I am trying to modify the RPAT form (frmrpat) to suit my needs however I cannot resolve the following details:
1. Adapt the following macro from a YouTube tutorial
>>> use code - tags <<<
to search for the cases by the ID number and show the results in ListBox1, however it asks me to declare the variables Clear and Row and when doing so it does not carry out any kind of search and in ListBox1 all the cases present in the list continue to appear. Sheet3 (MATRIZ).
2. Depending on the case (AT or EO) that has been selected in Combobox1, ListBox1 should filter and reflect the number of cases associated with the identification number searched in TextBox11 when in Sheet3 (MATRIZ) AU=”” and AU <>””
I am trying to modify the RPAT form (frmrpat) to suit my needs however I cannot resolve the following details:
1. Adapt the following macro from a YouTube tutorial
>>> use code - tags <<<
Code:
Private Sub CmdBUSCAR_Click()
Dim UFILA As Integer
If Me.TextBox11 = "" Then
MsgBox "Ingrese el Número de Cédula", vbExclamation
End If
Exit Sub
ROW = Sheets("MATRIZ").Range("B" & Rows.Count).End(xlUp).Row
Me.ListBox1.RowSource = Clear
For Row = 2 To UFILA
If UCase(Range("B" & Row).Value) Like "*" & UCase(Me.TextBox11.Value) & "*" Then
Me.ListBox1.AddItem
Me.ListBox1.List(ListBox1.ListCount - 1, 0) = Cells(Row, 2)
Me.ListBox1.List(ListBox1.ListCount - 1, 19) = Cells(Row, 21)
Me.ListBox1.List(ListBox1.ListCount - 1, 23) = Cells(Row, 25)
Me.ListBox1.List(ListBox1.ListCount - 1, 24) = Cells(Row, 26)
Me.ListBox1.List(ListBox1.ListCount - 1, 45) = Cells(Row, 47)
End If
Next Row
Me.TextBox11.Value = Empty
Me.TextBox11.SetFocus
End Sub
to search for the cases by the ID number and show the results in ListBox1, however it asks me to declare the variables Clear and Row and when doing so it does not carry out any kind of search and in ListBox1 all the cases present in the list continue to appear. Sheet3 (MATRIZ).
2. Depending on the case (AT or EO) that has been selected in Combobox1, ListBox1 should filter and reflect the number of cases associated with the identification number searched in TextBox11 when in Sheet3 (MATRIZ) AU=”” and AU <>””
Attachments
Last edited by a moderator: