question

JosAlejandroFajardo-7296 avatar image
0 Votes"
JosAlejandroFajardo-7296 asked

Error 381: could not set list promerty. invalid property array index

Hi, I have the error: Error 381: could not set list promerty. invalid property array index

could you let me know my mistake in this code:

Private Sub CMDBuscar_Click()

 If TXT_Buscar.Text = "" Then
     MsgBox ("Por favor ingresar apellidos a buscar"), vbExclamation, "Error de busqueda"
     TXT_Buscar.SetFocus
     Exit Sub
 End If
 LST_Buscar.Clear
 Xnum = Range("TablaDatos").CurrentRegion.Rows.Count
 For i = 3 To Xnum + 2
     If LCase(Cells(i, 4).Value) Like "*" & LCase(Me.TXT_Buscar.Text) & "*" Then
         LST_Buscar2.AddItem Cells(i, 1)
         LST_Buscar2.List(LST_Buscar.ListCount - 1, 1) = Cells(i, 2)
          LST_Buscar2.List(LST_Buscar.ListCount - 1, 2) = Cells(i, 3)
           LST_Buscar2.List(LST_Buscar.ListCount - 1, 3) = Cells(i, 4)
            LST_Buscar2.List(LST_Buscar.ListCount - 1, 4) = Cells(i, 5)
                        
     End If
 Next i

End Sub

gracias.

office-scripts-excel-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers