View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default General programming help

You need to work from the bottom of UsedRange back up to the top.
--
Gary''s Student


"Erik" wrote:

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