View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default General programming help

the trick is to work from the bottom up
for i=cells(rows.count,"a").end(xlup).row to 2 step -1
if cells(i,"a") etc
next i

--
Don Guillett
SalesAid Software

"Erik" wrote in message
...
I'm trying to use the code below to delete rows from a sheet. The problem
is
that as it deletes a row, it then skips the next one. How can I create a
list of the rows to be deleted and delete them all at once after the For
loop?

Set ColA = Intersect(Sheet1.Columns("A"), Sheet1.UsedRange)
For Each cell In ColA
If cell.Value = Empty And Not cell.Offset(0, 1).Value = "Weekend
Diff"
Then
cell.EntireRow.Delete shift:=xlUp
End If
Next cell