lifeson
11-20-2008, 06:44 AM
I have a loop routine that loops through 20 rows of data and adds the results to a list view
Under certain conditions the loop will remove some rows of data when the routine does the next row how do I reduce the number of rows it searches? as the list view will still have the original 20 rows but has blank rows at the end
for i = 2 to r '20 rows
'do some stuff
Select Case chkComp
Case True
With listview
.ListItems.Add , , , , icon
End With
Case False
'MsgBox "Delete " & discID & " from row " & i
ws.Cells(i, "A").EntireRow.Delete
i = i - 1 'this doesn't reduce the number of rows from the original for loop
MsgBox r
End Select
Next i
Under certain conditions the loop will remove some rows of data when the routine does the next row how do I reduce the number of rows it searches? as the list view will still have the original 20 rows but has blank rows at the end
for i = 2 to r '20 rows
'do some stuff
Select Case chkComp
Case True
With listview
.ListItems.Add , , , , icon
End With
Case False
'MsgBox "Delete " & discID & " from row " & i
ws.Cells(i, "A").EntireRow.Delete
i = i - 1 'this doesn't reduce the number of rows from the original for loop
MsgBox r
End Select
Next i