Thread: Row Delete
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
kkknie[_15_] kkknie[_15_] is offline
external usenet poster
 
Posts: 1
Default Row Delete

One problem is that if the lines to be deleted come right after eac
other, the second one will not get deleted. This is because when yo
delete the row and increment the y variable, it skips the row after th
one you deleted (because it moves up one).

The fix should be:


Code
-------------------
y = 5
Do While Range("A" & y) < ""
If Range("F" & y).Value = "957-TYPE" Or _
Range("F" & y).Value = "149-DUPLICATE" Then
Range("F" & y).EntireRow.Delete
y = y - 1
End If
y = y + 1
Loo
-------------------



--
Message posted from http://www.ExcelForum.com