Hmm...simple problem, simple answer.
Here's a solution:
Code:
Private Sub Command1_Click()
Dim x As Long, c As Boolean
Do Until x = List1.ListCount - 1
c = False
If List1.List(x) = "" Then
List1.RemoveItem x
c = True
End If
If c = False Then x = x + 1
Loop
List1.Refresh
End Sub
Your code:
Code:
For x = 0 To List1.ListCount - 1
If List1.List(x) = "" Then
List1.RemoveItem x
'Whenever you remove an item, the LISTCOUNT changes, but VB would still
'try to get x to the OLD Listcount, so using Do Until solves the problem!
'You can also use Do While.
End If
Next x
List1.Refresh
Satisfactory? 

