 To .Count
            With .Item(i).SubItems(1)
               .IconIndex = Rnd * ilsIcons16.ImageCount
               Debug.Print .IconIndex
            End With
         Next i
      End With
   End If
End Sub

Private Sub cmdAdd_Click()
Dim sText As String
Dim sKey As String
On Error GoTo ErrorHandler
   sText = InputBox$("Please enter the caption of the item to add", , "Test
    Item " &amp; lvwMain.ListItems.Count + 1)
   If sText &lt;&gt; "" Then
      sKey = InputBox$("Please enter the key for the i