title: Could not set the List property. Invalid property array index
body: <p><a href="https://i.stack.imgur.com/KtpPd.png" rel="nofollow noreferrer">Image</a>i created an Excel userform. In the listbox when i try to delete a row it's giving me an error Could not set the List property. Invalid property array index. </p>
  
  <blockquote>
    <p>Delete Command</p>
  </blockquote>
  
  <pre><code>Private Sub CmdDelete_Click()
  
  Dim i As Integer
  For i = 1 To Range("A1000000").End(xlUp).Row
  If Cells(i, 1) = Listbox1.List(Listbox1.ListIndex) Then
  Rows(i).Select
  Selection.Delete
  End If
  Next i
  End Sub
  </code></pre>