Thread: Deleting Rows
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Deleting Rows

Dim lastrow as Long, i as long
dim cnt as long
lastrow = cells(rows.count,1).End(xlup).row
for i = Lastrow to 1 step - 1
cnt = application.CountA(cells(i,1).EntireRow)
if cnt < 11 and cnt < 4 then
cells(i,1).Entirerow.Delete
end if
Next

--
Regards,
Tom Ogilvy

"David Bateman" wrote in message
...
What would be the proper code to remove all rows in a workbook except the
rows that counta = 11 or counta = 4. Thank you in advance